Groups | Blog | Home
all groups > asp.net building controls > january 2005 >

asp.net building controls : ASP.NET Server Control - File Browse



Ryan
1/18/2005 7:45:07 AM
I am trying to create a custom ASP.NET server control which has a field while
requires a file browser (similar to the src property in the Image server
control). I know I need to use the System.ComponentModel.Editor(typeof(..))
syntax, but I don't know what type to use... can someone help me out?

Ryan
1/18/2005 2:45:07 PM
So, I'm trying this:

using System;
using System.Web.UI.Design;

namespace test
{
public class FileUrlEditor : UrlEditor
{
FileUrlEditor()
{

}

protected override string Filter
{
get
{
//return base.Filter;
return "All Files (*.*)|*.*";
}
}
}
}

and then using:
Editor(typeof(FileUrlEditor), typeof(System.Drawing.Design.UITypeEditor))

but no luck... it shows up in the designer "greyed-out" and not active...
Rogerio Pereira Araujo
1/18/2005 5:58:19 PM
[quoted text, click to view]

You need to create a class that inherits from UrlEditor and then you can
use this class in the as a parameter of Editor atribute like this:

public FileUrlEditor : UrlEditor
{
FileUrlEditor()
{

}

public override Filter
{
get "All Files (*.*)|*.*";
}
}


And then:

[
System.ComponentModel.Editor(typeof(..))
]
public string YourProperty
{
get{};
set{};
}


I hope this helps,

Rogerio Pereira Araujo
1/18/2005 6:02:27 PM
A quick fix:

public FileUrlEditor : UrlEditor
{
FileUrlEditor()
{

}

public override Filter
{
get
{
return "All Files (*.*)|*.*";
}
}
}

Sorry,

Rogerio Pereira Araujo
1/19/2005 6:47:29 PM
Try to use full namespace:

Editor(typeof(test.FileUrlEditor),
typeof(System.Drawing.Design.UITypeEditor))

Rogério

AddThis Social Bookmark Button