c# - Show asp:Panel stored in different file -
i have asp page (.aspx) page, , asp:panel in it. use telerik library irrelevant, think.
i need move asp:panel tag outside main file, another, stand-alone, .aspx due file size , work organization.
i moved aspx content new file, , related code in .cs file, separated principal one.
on load_page of main 1 instantiate, through constructor, separate panel - constructor instantiates every control in panel, , has method .show().
every member work in new class, since new in asp not know how put separate aspx code in former file, since when call mymodalpopup.show() have effect of page reload
extract of panel in separate file:
<asp:panel id="panelid" runat="server"> <asp:hiddenfield id="control1" runat="server" /> <ajax:modalpopupextender id="extid" runat="server" targetcontrolid="control1"> </ajax:modalpopupextender> //html/controls stuff </asp:panel>
the mypanel.cs
protected editpanel mypanel = new editpanel(); public class editpanel: system.web.ui.page { protected panel mypanel; protected hiddenfield control1; public ajaxcontroltoolkit.modalpopupextender extender; //other controls public editpanel() { extender = new ajaxcontroltoolkit.modalpopupextender(); control1 = new hiddenfield(); //other inits } }
in main page .cs:
protected void page_load(object sender, eventargs e) { protected editpanel editor = new editpanel(); //... on }
in main page.aspx tried (without success)
<asp:panel id="panelid" runat="server"> <!-- #include virtual="~/path/editpanel.aspx" --> </asp:panel>
Comments
Post a Comment