Newbie Question !!! Datagrid event problem

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!!!!
 
G

Guest

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,073
Latest member
DarinCeden

Latest Threads

Top