Russ,
Try to check
If IsNumeric(e.CommandArgument) Then
Fan.
----- Original Message -----
From: Russ Peters
To: aspnet aspadvice.com
Sent: Monday, April 14, 2008 5:26 PM
Subject: [aspnet] Gridview question
Looking to change the value of a column to zero when a
button in another column is clicked. What I have is a
shopping cart list of items with a promo code column. If
someone has a promo code I want to change the price field to
zero and then update the total price to reflect that. What
I'm struggling with is how to gain access to the price
columns value and change it without rebinding to the
datasource.
Not sure if I gave you enough information to help me out
but this is a start. Basically here all I'm trying to do
is get the values out of the gridview and I can't seem to do
that. Once I get the values then I can try and change them.
I get the error:
Input string was not in a correct format.
Line 9: Dim index As Integer =
Convert.ToInt32(e.CommandArgument)
Here is what I have so far:
'fires after the button is clicked in the promo column.
Protected Sub Gridview1_RowCommand(ByVal sender As Object,
ByVal e As GridViewCommandEventArgs) Handles
GridView1.RowCommand
'trying to get the values prodID and Itemsize out
'of the gridview.
Dim index As Integer =
Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = GridView1.Rows(index)
Dim prodID As String =
Server.HtmlDecode(row.Cells(2).Text)
Dim ItemSize As String = row.Cells(4).Text
StoredShoppingCart.UpdateItem(prodID, ItemSize)
End Sub
Russ
--- List Settings ---
http://aspadvice.com/list
s/
--- List Settings ---
http://aspadvice.com/list
s/
|