Orzeh is right on this. Here is some sample code :
[System.ComponentModel.TypeConverter(typeof(DataSourceIDConverter))]
public String DataSourceID {
get {
String s = (String)ViewState["DataSourceID"];
return (s == null) ? String.Empty : s;
}
set {
ViewState["DataSourceID"] = value;
}
}
protected Control DataSource {
get {
if (DataSourceID == String.Empty)
return null;
else
return NamingContainer.FindControl(DataSourceID);
}
}
With the right TypeConvertor you can show a dropdownlist with only the IDs of the type of controls you want to attach (in this case only DataSource controls).
srillaert
Member
75 Points
15 Posts
Re: How to reference other object in a custom properties?
Jan 24, 2006 10:42 AM|LINK
[System.ComponentModel.TypeConverter(typeof(DataSourceIDConverter))]
public String DataSourceID {
get {
String s = (String)ViewState["DataSourceID"];
return (s == null) ? String.Empty : s;
}
set {
ViewState["DataSourceID"] = value;
}
}
protected Control DataSource {
get {
if (DataSourceID == String.Empty)
return null;
else
return NamingContainer.FindControl(DataSourceID);
}
}
With the right TypeConvertor you can show a dropdownlist with only the IDs of the type of controls you want to attach (in this case only DataSource controls).
Have fun.
My Blog