J
Jeff
Hey
asp.net 2.0
In the source I posted below, there is a GridView (look at the bottom of the
script):
<asp:GridView ID="gvwOnline" runat="server">
</asp:GridView>
I'm trying to assign a datasource to this GridView in runtime. But I cannot
access thte GridView during runtime...
I've tryed these ways of accessing the GridView:
method 1:
TableCell tableCell = (TableCell)Table1.FindControl("TableCell1");
GridView gvwOnline = (GridView)tableCell.FindControl("gvwOnline");
method 2:
gvwOnline directly - gvwOnline.DataSource
method 3
GridView gvwOnline = (GridView)table1.FindControl("gvwOnline");
But the gvwOnline gets the value NULL from all those methods above
Any suggestions?
<asp:Table ID="Table1" runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell ID="TableCell1" VerticalAlign="Top" SkinID="left" >
<div class="sidebar">
<asp:LoginView ID="LoginView2" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="members">
<ContentTemplate>
<asp:LoginName ID="LoginName1" runat="server" FormatString="Welcome,
{0}." />
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutPageUrl="../Default.aspx" />
<asp:Menu ID="mnuSidemenu" runat="server" DataSourceID="smdsHeader"
MaximumDynamicDisplayLevels="0" Orientation="Vertical"
StaticDisplayLevels="2" />
<asp:SiteMapDataSource ID="smdsHeader" runat="server"
SiteMapProvider="Members" ShowStartingNode="false" StartingNodeOffset="1" />
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="Administrators">
<ContentTemplate>
<asp:LoginName ID="LoginName1" runat="server" FormatString="Welcome,
{0}." />
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutPageUrl="../Default.aspx" />
<asp:Menu ID="mnuSidemenu" runat="server" DataSourceID="smdsHeader"
MaximumDynamicDisplayLevels="0" Orientation="Vertical"
StaticDisplayLevels="2" />
<asp:SiteMapDataSource ID="smdsHeader" runat="server"
SiteMapProvider="Administrators" ShowStartingNode="false"
StartingNodeOffset="1" />
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
<LoggedInTemplate>
<div class="sideWelcome">
<asp:LoginName ID="LoginName1" runat="server" FormatString="Welcome, {0}."
/>
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutPageUrl="../Default.aspx" CssClass="sidemenuGeneral" />
</div>
<div class="sidepane">
<asp:Menu ID="mnuSidemenu"
runat="server"
DataSourceID="smdsHeader"
MaximumDynamicDisplayLevels="0"
Orientation="Vertical"
StaticDisplayLevels="2" StaticMenuItemStyle-CssClass="sidemenuGeneral"
StaticHoverStyle-CssClass="sidemenuHover">
</asp:Menu>
<asp:SiteMapDataSource ID="smdsHeader" runat="server"
SiteMapProvider="Members" ShowStartingNode="false" StartingNodeOffset="1" />
</div>
<div class="sidepane">
Users online<br />
<asp:GridView ID="gvwOnline" runat="server">
</asp:GridView>
</div>
</LoggedInTemplate>
</asp:LoginView>
</div>
asp.net 2.0
In the source I posted below, there is a GridView (look at the bottom of the
script):
<asp:GridView ID="gvwOnline" runat="server">
</asp:GridView>
I'm trying to assign a datasource to this GridView in runtime. But I cannot
access thte GridView during runtime...
I've tryed these ways of accessing the GridView:
method 1:
TableCell tableCell = (TableCell)Table1.FindControl("TableCell1");
GridView gvwOnline = (GridView)tableCell.FindControl("gvwOnline");
method 2:
gvwOnline directly - gvwOnline.DataSource
method 3
GridView gvwOnline = (GridView)table1.FindControl("gvwOnline");
But the gvwOnline gets the value NULL from all those methods above
Any suggestions?
<asp:Table ID="Table1" runat="server" Width="100%">
<asp:TableRow>
<asp:TableCell ID="TableCell1" VerticalAlign="Top" SkinID="left" >
<div class="sidebar">
<asp:LoginView ID="LoginView2" runat="server">
<RoleGroups>
<asp:RoleGroup Roles="members">
<ContentTemplate>
<asp:LoginName ID="LoginName1" runat="server" FormatString="Welcome,
{0}." />
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutPageUrl="../Default.aspx" />
<asp:Menu ID="mnuSidemenu" runat="server" DataSourceID="smdsHeader"
MaximumDynamicDisplayLevels="0" Orientation="Vertical"
StaticDisplayLevels="2" />
<asp:SiteMapDataSource ID="smdsHeader" runat="server"
SiteMapProvider="Members" ShowStartingNode="false" StartingNodeOffset="1" />
</ContentTemplate>
</asp:RoleGroup>
<asp:RoleGroup Roles="Administrators">
<ContentTemplate>
<asp:LoginName ID="LoginName1" runat="server" FormatString="Welcome,
{0}." />
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutPageUrl="../Default.aspx" />
<asp:Menu ID="mnuSidemenu" runat="server" DataSourceID="smdsHeader"
MaximumDynamicDisplayLevels="0" Orientation="Vertical"
StaticDisplayLevels="2" />
<asp:SiteMapDataSource ID="smdsHeader" runat="server"
SiteMapProvider="Administrators" ShowStartingNode="false"
StartingNodeOffset="1" />
</ContentTemplate>
</asp:RoleGroup>
</RoleGroups>
<LoggedInTemplate>
<div class="sideWelcome">
<asp:LoginName ID="LoginName1" runat="server" FormatString="Welcome, {0}."
/>
<asp:LoginStatus ID="LoginStatus1" runat="server"
LogoutPageUrl="../Default.aspx" CssClass="sidemenuGeneral" />
</div>
<div class="sidepane">
<asp:Menu ID="mnuSidemenu"
runat="server"
DataSourceID="smdsHeader"
MaximumDynamicDisplayLevels="0"
Orientation="Vertical"
StaticDisplayLevels="2" StaticMenuItemStyle-CssClass="sidemenuGeneral"
StaticHoverStyle-CssClass="sidemenuHover">
</asp:Menu>
<asp:SiteMapDataSource ID="smdsHeader" runat="server"
SiteMapProvider="Members" ShowStartingNode="false" StartingNodeOffset="1" />
</div>
<div class="sidepane">
Users online<br />
<asp:GridView ID="gvwOnline" runat="server">
</asp:GridView>
</div>
</LoggedInTemplate>
</asp:LoginView>
</div>