You can implement IPostBackDataHandler interface for your purpose.For example:
class MyDropDownList:WebControl,IPostBackDataHandler{
// below,your must implement IPostBackDataHandler's method.
bool LoadPostData(string postDataKey, NameValueCollection postCollection){
// check postback data here
}
void RaisePostDataChangedEvent(){
// raise your event here.
}
}
"TJS" wrote:
> I am rendering a dropdownlist from HTMLTextWriter, how do I specify to
> enable autopostback ?
>
> '=========================================
> ....
> writer.AddAttribute(HtmlTextWriterAttribute.Id, "xx")
> writer.AddAttribute(HtmlTextWriterAttribute.Name, "xx")
> writer.RenderBeginTag(HtmlTextWriterTag.Select)
>
> writer.AddAttribute( HtmlTextWriterAttribute.Value, "-1" )
> writer.RenderBeginTag(HtmlTextWriterTag.Option)
> writer.Write( HttpUtility.HtmlEncode("-- All --") )
> writer.RenderEndTag()
>
> writer.RenderEndTag()
> ....
>
>
>
|