Friday, March 16, 2012

On Page Load, looking to see if Grid is populated.

I have run into this a few times looking for a Textbox located inside of a form or a gridview inside of a loginview.

If it's not inside of the FormView, Intellisense picks it right up. how can I get Gridview2 located inside of the formview to check at page_load?


<script runat="server"
protected void Page_Load(object sender, EventArgs e)
{

}
</script
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width: 100%">
<tr>
<td style="width: 100px; vertical-align: top; text-align: left;">
<asp:LoginView ID="LoginView1" runat="server">
<AnonymousTemplate>
<asp:Login ID="Login1" runat="server" CreateUserText="Need to Register?" CreateUserUrl="~/Signup.aspx" PasswordRecoveryText="Forget your Password?" PasswordRecoveryUrl="~/PasswordRecovery.aspx" Height="208px">
</asp:Login>
</AnonymousTemplate>
<LoggedInTemplate>
Welcome Back
<asp:LoginName ID="LoginName1" runat="server" />
<br />
<table style="; position: static">
<tr>
<td style="width: 100px">
</td>
</tr>
<tr>
<td style="width: 400px">
<span style="font-size: 14pt; color: dimgray"><strong>Today's Sales<asp:Label ID="Label6"
runat="server" Text="Today's Sales Label"></asp:Label></strong></span></td>
</tr>
<tr>
<td style="width: 400px">
<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" BackColor="LightGoldenrodYellow"
BorderColor="Tan" BorderWidth="1px" CellPadding="2" DataSourceID="SqlDataSource2"
ForeColor="Black" GridLines="None" Style="width: 400px">
<FooterStyle BackColor="Tan" />
<Columns>

In your supplied code, there is no FormView. Your GridView however is within a LoginView which requires that you be logged in to have access to the GridView.

0 comments:

Post a Comment