Sign In| Join
Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Jun 15, 2012 06:53 AM by Mohammad Ali keerio
Member
29 Points
90 Posts
Jun 15, 2012 05:19 AM|LINK
hi here is my code,
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate > <div class="grid"> <asp:TabContainer ID="TabGrid" runat="server" ActiveTabIndex="0" Height="542px" Width="1006px"> <asp:TabPanel ID="TabGrid1" runat="server" HeaderText="TabPanel1"> <ContentTemplate> <cc1:Grid ID="grid1" runat="server" FolderStyle="premiere_blue" AllowAddingRecords="False" AutoGenerateColumns="False" AutoPostBackOnSelect="True" AllowPageSizeSelection="False" AllowFiltering="True"> <Columns> <cc1:Column DataField="airlineimg" HeaderText="Airline" Index="0" Width ="76"> <TemplateSettings TemplateId="Image1" /> </Columns> </cc1:Grid> </ContentTemplate> </asp:TabPanel> </asp:TabContainer> </div> </ContentTemplate> </asp:UpdatePanel>
code behind: GridView grd1 =UpdatePanel1.FindControl("TabGrid").FindControl("TabGrid1").FindControl("grid1") as GridView; //error:null reference bcoz grd1=null grd1.DataSource = list[t - 1]; grd1.DataBind();
322 Points
64 Posts
Jun 15, 2012 06:53 AM|LINK
Hi,
Dear there is no need to UpdatePanel1.FindControl try this hope this will helps you
//if you have use master page then use this one
//MainContent is content ID of contentplaceholder which is use in inner pages
GridView grd=Master.FindControl("MainContent").FindControl("TabGrid1") as GridView;
// if simply you have to use like that
GridView grd = Page.FindControl("TabGrid1") as GridView;
hari.infotec...
Member
29 Points
90 Posts
how to find a control inside the webform?
Jun 15, 2012 05:19 AM|LINK
hi here is my code,
<asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate > <div class="grid"> <asp:TabContainer ID="TabGrid" runat="server" ActiveTabIndex="0" Height="542px" Width="1006px"> <asp:TabPanel ID="TabGrid1" runat="server" HeaderText="TabPanel1"> <ContentTemplate> <cc1:Grid ID="grid1" runat="server" FolderStyle="premiere_blue" AllowAddingRecords="False" AutoGenerateColumns="False" AutoPostBackOnSelect="True" AllowPageSizeSelection="False" AllowFiltering="True"> <Columns> <cc1:Column DataField="airlineimg" HeaderText="Airline" Index="0" Width ="76"> <TemplateSettings TemplateId="Image1" /> </Columns> </cc1:Grid> </ContentTemplate> </asp:TabPanel> </asp:TabContainer> </div> </ContentTemplate> </asp:UpdatePanel>code behind: GridView grd1 =UpdatePanel1.FindControl("TabGrid").FindControl("TabGrid1").FindControl("grid1") as GridView;
//error:null reference bcoz grd1=null
grd1.DataSource = list[t - 1]; grd1.DataBind();
Mohammad Ali...
Member
322 Points
64 Posts
Re: how to find a control inside the webform?
Jun 15, 2012 06:53 AM|LINK
Hi,
Dear there is no need to UpdatePanel1.FindControl try this hope this will helps you
//if you have use master page then use this one
// if simply you have to use like that
GridView grd = Page.FindControl("TabGrid1") as GridView;Please "Mark as Answer" if this post helps.