Wrox Programmer Forums
|
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 2nd, 2007, 02:29 PM
Authorized User
 
Join Date: Sep 2006
Posts: 82
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataGrid Error

Hi,

Within an asp.net page I keep receiving the following error :

Public member 'DataGridCommandArgument' on type 'DataGrid' not found.
Description: An unhandled exception occurred during the execution of the current

web request. Please review the stack trace for more information about the error

and where it originated in the code.

Exception Details: System.MissingMemberException: Public member

'DataGridCommandArgument' on type 'DataGrid' not found.

Source Error:

Line 110: 'Passes ProductID as sender
Line 111:
Line 112: Dim intProductID As Integer =

sender.DataGridCommandArgument'<%# DataBinder.Eval(Container.DataItem,

"intProductID")%>'
Line 113:
Line 114:



This page is part of an e-commerce website in asp.net 1.1, vb2003 and connecting

to an access database. Basically within this checkout page I'm trying to check

there is sufficient quantity of items in stock before a customer checks out. The

way I have designed the site is that the ProductID (intProductID) is passed as a

sender to identify the relevant item within the database. Please advise how to

resolve this error. Here's some of the relevant code :

Code:
 Sub dgCart_Update(sender As Object, e As DataGridCommandEventArgs)

        Dim strConnString As String = 

ConfigurationSettings.AppSettings.Get("ConnectionString")
        strConnString = String.Format(strConnString, 

Server.MapPath("\db\nwguitars.mdb"))
        Dim dbConnection As System.Data.IDbConnection = New 

System.Data.OleDb.OleDbConnection(strConnString)

        Dim intCartitemID As Integer
        Dim txtQuantity As TextBox
        Dim intQuantity As Integer

        'Passes ProductID as sender

        Dim intProductID As Integer = sender.DataGridCommandArgument'<%# 

DataBinder.Eval(Container.DataItem, "intProductID")%>'


        intCartitemID = dgCart.DataKeys(e.Item.ItemIndex)
        txtQuantity = e.Item.FindControl("txtQuantity")
        intQuantity = txtQuantity.Text

        'Define intQuantityInStock and reference to CheckQuantity function
        Dim intQuantityInStock As Integer = CheckQuantity(intProductID)

        lblQuantity.Text = intQuantity
        lblQuantity.Visible = False

        'If statement to check enough quantity in stock
        If intQuantityInStock < intQuantity
            lblError.Text = "This item is currently low in stock. Please select an 

alternative</b>"
            lblError.Visible = True
        Else
            Dim strSQL As String = "UPDATE [tblCartItems] SET 

[intQuantityOrder]=@Quantity WHERE "& _
            "intCartitemID = @intCartitemID"

            Dim dbCommand As New OleDbCommand(strSQL, dbConnection)

            Dim cmd As New OleDbCommand

            dbCommand.Parameters.Add("@Quantity", intQuantity)
            dbCommand.Parameters.Add("@intCartitemID", intCartitemID)

            dbConnection.Open()
            dbCommand.ExecuteNonQuery()
            dbConnection.Close()

            dgCart.EditItemIndex = -1
            dgCart.DataSource = DisplayCart()
            dgCart.DataBind()

        End If

    End Sub
Thanks,







Similar Threads
Thread Thread Starter Forum Replies Last Post
Error in displaying datagrid lamort ASP.NET 1.0 and 1.1 Basics 0 December 1st, 2006 01:02 PM
Datagrid error lily611 General .NET 4 December 8th, 2004 10:00 AM
datagrid paging error RPG SEARCH ASP.NET 1.0 and 1.1 Basics 1 November 9th, 2004 08:29 AM
One Row in DataGrid error petersonginae VB.NET 2002/2003 Basics 2 July 14th, 2004 05:14 PM
DataGrid Error spm74 ASP.NET 1.0 and 1.1 Basics 0 May 20th, 2004 06:07 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.