c# - UserControl not rendering correctly -
i have 2 usercontrols , 1 view. have grid button when clicked, sends object parent (the view) , uses object update second control. problem though when debug it, once page renders again, second usercontrol still not visible , textbox remains empty.
the first usercontrol called ctrlmyroster ascx:
<%@ register assembly="telerik.web.ui" namespace="telerik.web.ui" tagprefix="telerik" %> <telerik:radgrid id="radgmyrosters" cssclass="radgmyrosters" runat="server" allowpaging="true" allowsorting="true" autogeneratecolumns="false" onitemcommand="radgmyrosters_itemcommand"> <mastertableview> <columns> <telerik:gridboundcolumn datafield="rostername" headertext="rostername" datatype="system.string" uniquename="rostername"> </telerik:gridboundcolumn> <telerik:gridtemplatecolumn headerstyle-cssclass="grid-header" headerstyle-width="51px" itemstyle-horizontalalign="center" itemstyle-verticalalign="middle"> <itemtemplate> <asp:button id="btneditroster" runat="server" cssclass="btngreen" commandname="edits" text="edit"></asp:button> </itemtemplate> </telerik:gridtemplatecolumn> </columns> </mastertableview> </telerik:radgrid>
ctrlmyroster codebehind
protected void page_load(object sender, eventargs e) { radgmyrosters.datasource = lstuserscurrentroster; } public event eventhandler editbuttonclicked; private void oneditbuttonclick(int rowselected) { if (editbuttonclicked != null) { editbuttonclicked(lstuserscurrentroster[rowselected], eventargs.empty); } } protected void radgmyrosters_itemcommand(object sender, telerik.web.ui.gridcommandeventargs e) { if (e.commandname == "edits") { oneditbuttonclick(e.item.itemindex); } }
the second usercontrol ctrlrosterdetail ascx
<%@ register assembly="telerik.web.ui" namespace="telerik.web.ui" tagprefix="telerik" %> <asp:label id="lblname" runat="server"> name: </asp:label><asp:textbox id="txtrostername" runat="server" ></asp:textbox>
ctrlrosterdetail codebehind
protected void page_load(object sender, eventargs e) { //empty }
viewmyroster ascx:
<%@ register assembly="telerik.web.ui" namespace="telerik.web.ui" tagprefix="telerik" %> <%@ register src="usercontrols/ctrlmyrosters.ascx" tagname="ctrlmyrosters" tagprefix="mycontrols" %> <%@ register src="usercontrols/ctrlrosterdetails.ascx" tagname="ctrlrosterdetails" tagprefix="mycontrols" %> <telerik:radajaxpanel runat="server" id="rapcreatewindowcontainer" loadingpanelid="ralploadingpanel"> <aau:ctrlmyrosters id="ctrlmyrosters1" runat="server" /> <aau:ctrlrosterdetails id="ctrlrosterdetails1" runat="server" visible="false" /> </telerik:radajaxpanel>
viewmyroster codebehind
protected void page_load(object sender, eventargs e) { ctrlmyrosters1.editbuttonclicked += new eventhandler(ctrlmyrosters1_editbuttonclicked); } private void ctrlmyrosters1_editbuttonclicked(object sender, eventargs e) { ((textbox)ctrlrosterdetails1.controls[0]).text = ((eventroster)sender).name; ctrlrosterdetails1.visible = true; }
am missing something? maybe it's .net page lifecycle?
maybe should use different approach? want pass information first usercontrol second usercontrol.
Comments
Post a Comment