List Info

Thread: RE: Gridview question




RE: Gridview question
country flaguser name
China
2008-04-14 17:19:17
Russ,

Try to check
    If IsNumeric(e.CommandArgument) Then

Fan.
  ----- Original Message ----- 
  From: Russ Peters 
  To: aspnetaspadvice.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/


RE: Gridview question
country flaguser name
United States
2008-04-15 07:32:13
iterate through the dataTable.rows in the datasource, then rebind.

> From: fan_shiguohotmail.com
> Subject: [aspnet] RE: Gridview question
> Date: Mon, 14 Apr 2008 18:19:17 -0400
> To: aspnetaspadvice.com
>
> Russ,
>
> Try to check
> If IsNumeric(e.CommandArgument) Then
>
> Fan.
> ----- Original Message -----
> From: Russ Peters
> To: aspnetaspadvice.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/lists/
>
>
>
> --- List Settings ---
> http://aspadvice.com/lists/
>


Pack up or back up–use SkyDrive to transfer files or keep extra copies. Learn how. --- List Settings ---
http://aspadvice.com/lists/
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )