Newbie Question !!! Datagrid event problem

  • Thread starter Thread starter AlecL
  • Start date Start date
A

AlecL

I have a dtagrid with two TemplateColumns one contains a textbox and
the other a imagebutton. To capture the value in the textbox when the
imagebutton is clicked I am using the itemcommand event of the
datagrid which is defined as :

<asp:DataGrid ID="dgproducts1" runat="server"
AutoGenerateColumns="false" Width="504px" OnItemCommand="GetRowInfo">

I have put an event handler in the page_load as:

AddHandler dgproducts1.ItemCommand, AddressOf GetRowInfo

but when the button is clicked it does not perform what is in
GetRowInfo sub whichis:

Protected Sub GetRowInfo(ByVal source As Object, ByVal e As
DataGridCommandEventArgs)
Dim prodkey As String = e.Item.Cells(3).Text
Dim prodQty As Integer = e.Item.Cells(2).Text
If e.CommandName = "btnBuyOnline" Then
Response.Redirect("store_shoppingcart.aspx?pkey=" &
prodkey & prodQty)
End If
End Sub

Please help!!!!
 
Hi Alec,

The question is how you bind the grid view. Seems you bind the data on every
postback which is more likely the cause of you problem. Could you provide the
code please?
 
Back
Top