Solved

Updating quantity in GridView

Posted on 2009-05-11
2
465 Views
Last Modified: 2013-11-27
Hi guys,

I have a GridView in my cart. Everything works perfectly. The columns are auto-generated with the following code. I want to have textboxes in quantity column instead of just text. I want users to be able to input new quantity value and click button Update Quantities in order to update quantities for the items quantities of which were changed. Or any other way that you can offer of doing that. Newegg.com cart does this beautifully.

Thank you.

Dim strSQL1 As String = "SELECT P.Title, P.Artist, P.Price, SUM(P.Price) AS SubTotal, Count(P.ProductID) AS Qty FROM Products P, Cart C WHERE C.SessionID='" & _

                                    Session.SessionID & "' AND P.ProductID=C.ProductFK1 GROUP BY P.Title, P.Artist, P.Price"

 

Dim sqlCommand1 As New System.Data.SqlClient.SqlCommand(strSQL1, sqlConnection)

Dim rdr As System.Data.SqlClient.SqlDataReader = sqlCommand1.ExecuteReader

Dim dt As System.Data.DataTable = New System.Data.DataTable

dt.Load(rdr)

GridView1.DataSource = dt

GridView1.DataBind()

Open in new window

0
Comment
Question by:RealSnaD
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 24358212
I would think that if you want edit controls (TextBox, DropDownList, ...), then it would be better to define the columns as TemplateFields, and then define the edit controls in the EditItemTemplate.
0
 
LVL 7

Author Comment

by:RealSnaD
ID: 24413958
That's what I did, thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now