Sunday 15 April 2012

c# - Find a panel in a asp page with panel id -



c# - Find a panel in a asp page with panel id -

in app fetch panel id database , in webpage need find panel id need create visible false. code behind

protected sub page_load(byval sender object, byval e system.eventargs) handles me.load seek dim kioskxml string = "pnlfindid" dim mycontrol1 command = page.findcontrol(kioskxml) if (not mycontrol1 nothing) mycontrol1.visible = false end if grab ex exception end seek end sub

but above code snippet, cannot fetch panel works fine controls textbox , other. need way find panel id on page load

my html page

<asp:content id="content1" contentplaceholderid="contentplaceholder1" runat="server"> <ajaxtoolkit:toolkitscriptmanager id="toolkitscriptmanager1" runat="server"> </ajaxtoolkit:toolkitscriptmanager> <div onload="disablebackbutton();"> <table align="center" width="100%" cellpadding="0" cellspacing="0"> <tr> <td> <asp:panel id="pnlfindid" runat="server"> <table align="center" width="100%" cellpadding="0" cellspacing="0"> <tr> <td> <asp:panel id="pane3" runat="server"> </asp:panel> </td> </tr> </table> </asp:panel> </td> </tr> </table>

</asp:content>

thanks

i assuming trying find command in content pages's load event opposed master page's load event.

you need first find contentplaceholder , find panel within contentplaceholder not familiar vb.net syntax, providing c# syntax:

contentplaceholder cont = (contentplaceholder)this.master.findcontrol("contentplaceholder1"); panel mypanel = cont.findcontrol(kioskxml);

ofcourse, else, if doing on master page's page load event,

contentplaceholder cont = (contentplaceholder)this.findcontrol("contentplaceholder1"); panel mypanel = cont.findcontrol(kioskxml);

c# asp.net vb.net

No comments:

Post a Comment