Last post Oct 10, 2012 10:04 PM by Decker Dong - MSFT
Oct 09, 2012 09:22 AM|sanarojesuraj|LINK
I've an User Control with 4 text boxes and I use this User Control in many pages.
Now, I want to show only 2 or 3 textboxes in User Control based on permission in web pages.
How to hide server controls in User control at runtime?
Oct 09, 2012 09:27 AM|kaushikmaheta|LINK
i hop help this code
private void Page_Load(object sender, System.EventArgs e)
// Load the Header UserControl. Control hdrCtl = null;
hdrCtl = LoadControl("./controls/SiteHeader.ascx");
if (hdrCtl != null)
((SiteHeader)hdrCtl).LeftLogoImgPath = "..\\images\\ps_logo.gif";
((SiteHeader)hdrCtl).RightLogoImgPath = "..\\images\\ps_name.gif";
catch (Exception ex)
Oct 09, 2012 09:57 AM|sgamitava|LINK
define a public method in the usercontrol which will control the visibility of text boxes.
Call the public method on page prerender.
Hope this will help.
Oct 10, 2012 10:04 PM|Decker Dong - MSFT|LINK
I think you can just use FindControl to find certain controls from the user control and then use its Visible property to set with "true" or "false".