开发者

Finding html element onPreRender state of User Control

I have a user control which has html elements like <input type="button".... and i want to set its display property开发者_如何转开发 on preRender state.

Would you please explain, what kind things i have to handle this user control? So, in this function protected override void OnPreRender(EventArgs e) { } I have only EventArgs e and it doesn't have proper method or properties to bring me the html of user control.

Thank you from now...


The easiest way to control visibility of elements from the server side is to promote them to server controls. For example:

<input id="mybutton" runat="server" type="button" ...

Doing so would allow you to execute a statement like the following in your OnPreRender() event:

mybutton.Visible = false; // removes the element

Or...

mybutton.Style[HtmlTextWriterStyle.Display] = "none"; // styles the element
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜