开发者

Hide Checkbox on a particular page

I am working on ASP.NET application where I am reusing a user control. The user control contains a checkbox and bunch of other controls. I want to display all the controls inside 开发者_开发百科the user control on all the pages but on one single page I want to hide the checkbox.

I was thinking that I can use the databind methods and see if I am on the "pagex" then hide the checkbox. Is there any other way to solve this problem?


If you have access to the code for the control you should be add a new property to the control for hiding/showing the checkbox and then just pass in the property depending upon what page you are on. You'd have to pass in the show/hide property on the load event of the page.

Do you have access to the code??


I would specify a parameter in the code behind for your ascx file. Example:

public bool HideCB = false;

THen when you put your User Control on your aspx page do this:

<uc:TestControl id="TestControl" runat="Server" HideCB="true" />

This way you can do a check on if(HideCB) to determine if you want to make it visible or not.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜