Problems with Login View -Newbie

Discussion in 'ASP.NET / ASP.NET Core' started by JimL, Jul 18, 2006.

Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.
  1. I'm having a strange issue with Using a gridview in a Login View.

    As soon as I wrap the grid view in the template tags it's event are no longer assessable in the code behide page.
    The error I'm getting is that the grid view is not defined. What am I missing? I've bolded where the Grid Veiw Error occurs.

    Thanks

    Here is my Code:

    <script runat='server'>

    Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
    Session.Add('QuizID', GridView1.SelectedIndex.ToString)
    End Sub
    </script>

    <html xmlns='http://www.w3.org/1999/xhtml' >
    <head runat='server'>
    <title>Untitled Page</title>
    </head>

    <form id='form1' runat='server'>
    <div>
    <asp:LoginView ID='LoginView1' runat='server'>
    <AnonymousTemplate>
    <asp:GridView ID='GridView1' runat='server' AutoGenerateColumns='False' DataKeyNames='title_id'
    DataSourceID='SqlDataSource1' EmptyDataText='There are no data records to display.'
    OnSelectedIndexChanged='GridView1_SelectedIndexChanged'>
    <Columns>
    <asp:CommandField ShowSelectButton='True' />
    <asp:BoundField DataField='title_id' HeaderText='title_id' ReadOnly='True' SortExpression='title_id' />
    <asp:BoundField DataField='title' HeaderText='title' SortExpression='title' />
    <asp:BoundField DataField='type' HeaderText='type' SortExpression='type' />
    <asp:BoundField DataField='pub_id' HeaderText='pub_id' SortExpression='pub_id' />
    <asp:BoundField DataField='price' HeaderText='price' SortExpression='price' />
    <asp:BoundField DataField='advance' HeaderText='advance' SortExpression='advance' />
    <asp:BoundField DataField='royalty' HeaderText='royalty' SortExpression='royalty' />
    <asp:BoundField DataField='ytd_sales' HeaderText='ytd_sales' SortExpression='ytd_sales' />
    <asp:BoundField DataField='notes' HeaderText='notes' SortExpression='notes' />
    <asp:BoundField DataField='pubdate' HeaderText='pubdate' SortExpression='pubdate' />
    </Columns>
    </asp:GridView>
    <asp:SqlDataSource ID='SqlDataSource1' runat='server' ConnectionString='<%$ ConnectionStrings/emoticons/tongue.gifubsConnectionString1 %>'
    DeleteCommand='DELETE FROM [titles] WHERE [title_id] = @title_id' InsertCommand='INSERT INTO [titles] ([title_id], [title], [type], [pub_id], [price], [advance], [royalty], [ytd_sales], [notes], [pubdate]) VALUES (@title_id, @title, @type, @pub_id, @price, @advance, @royalty, @ytd_sales, @notes, @pubdate)'
    ProviderName='<%$ ConnectionStrings/emoticons/tongue.gifubsConnectionString1.ProviderName %>' SelectCommand='SELECT [title_id], [title], [type], [pub_id], [price], [advance], [royalty], [ytd_sales], [notes], [pubdate] FROM [titles]'
    UpdateCommand='UPDATE [titles] SET [title] = @title, [type] = @type, [pub_id] = @pub_id, [price] = @price, [advance] = @advance, [royalty] = @royalty, [ytd_sales] = @ytd_sales, [notes] = @notes, [pubdate] = @pubdate WHERE [title_id] = @title_id'>
    <InsertParameters>
    <asp:parameter Name='title_id' Type='String' />
    <asp:parameter Name='title' Type='String' />
    <asp:parameter Name='type' Type='String' />
    <asp:parameter Name='pub_id' Type='String' />
    <asp:parameter Name='price' Type='Decimal' />
    <asp:parameter Name='advance' Type='Decimal' />
    <asp:parameter Name='royalty' Type='Int32' />
    <asp:parameter Name='ytd_sales' Type='Int32' />
    <asp:parameter Name='notes' Type='String' />
    <asp:parameter Name='pubdate' Type='DateTime' />
    </InsertParameters>
    <UpdateParameters>
    <asp:parameter Name='title' Type='String' />
    <asp:parameter Name='type' Type='String' />
    <asp:parameter Name='pub_id' Type='String' />
    <asp:parameter Name='price' Type='Decimal' />
    <asp:parameter Name='advance' Type='Decimal' />
    <asp:parameter Name='royalty' Type='Int32' />
    <asp:parameter Name='ytd_sales' Type='Int32' />
    <asp:parameter Name='notes' Type='String' />
    <asp:parameter Name='pubdate' Type='DateTime' />
    <asp:parameter Name='title_id' Type='String' />
    </UpdateParameters>
    <DeleteParameters>
    <asp:parameter Name='title_id' Type='String' />
    </DeleteParameters>
    </asp:SqlDataSource>
    </AnonymousTemplate>
    </asp:LoginView>

    </div>
    </form>
     
Thread Status:
Threads that have been inactive for 5 years or longer are closed to further replies. Please start a new thread.

Share This Page