G
Guest
I dont know really know if this is a bug or not.
In my webform I hav
Header( User control
DataLis
Footer(User Control
The Header User Control has a Place Holder to which menu(another user control) is added dynamically based on the user role. (I have 3 menus for each role, and an appropriate menu is loaded based on the user logged in.
private void Page_Load(object sender, System.EventArgs e
/
Dynamically load the menu based on the user type
*
System.Web.UI.Control uc=null
if(HttpContext.Current.User.IsInRole("author")
uc=Page.LoadControl("~/UserControls/AuthorMenu.ascx")
else if(HttpContext.Current.User.IsInRole("reviewer")
uc=Page.LoadControl("~/UserControls/RevMenu.ascx")
else if(HttpContext.Current.User.IsInRole("planner")
uc=Page.LoadControl("~/UserControls/PlannerMenu.ascx")
else if(HttpContext.Current.User.IsInRole("planner")
uc=Page.LoadControl("~/UserControls/AdminMenu.ascx")
PlaceHolder1.Controls.Add(uc); //Source of the problem...
Problem
I have item template and edit templates in the datalist control
when I click the edit button in the item template the whole datalist control disappears on post back
I struggled for 2 days to zero in the source of the problem and finally found it
The problem arises if I add the dynamically loaded control(menu) to the placeholder in the header user control. If I comment that part out, everything works fine. Should I take this for a bug in .net or am I doing something wrong
Please hel
Kode.
In my webform I hav
Header( User control
DataLis
Footer(User Control
The Header User Control has a Place Holder to which menu(another user control) is added dynamically based on the user role. (I have 3 menus for each role, and an appropriate menu is loaded based on the user logged in.
private void Page_Load(object sender, System.EventArgs e
/
Dynamically load the menu based on the user type
*
System.Web.UI.Control uc=null
if(HttpContext.Current.User.IsInRole("author")
uc=Page.LoadControl("~/UserControls/AuthorMenu.ascx")
else if(HttpContext.Current.User.IsInRole("reviewer")
uc=Page.LoadControl("~/UserControls/RevMenu.ascx")
else if(HttpContext.Current.User.IsInRole("planner")
uc=Page.LoadControl("~/UserControls/PlannerMenu.ascx")
else if(HttpContext.Current.User.IsInRole("planner")
uc=Page.LoadControl("~/UserControls/AdminMenu.ascx")
PlaceHolder1.Controls.Add(uc); //Source of the problem...
Problem
I have item template and edit templates in the datalist control
when I click the edit button in the item template the whole datalist control disappears on post back
I struggled for 2 days to zero in the source of the problem and finally found it
The problem arises if I add the dynamically loaded control(menu) to the placeholder in the header user control. If I comment that part out, everything works fine. Should I take this for a bug in .net or am I doing something wrong
Please hel
Kode.