Link to home
Start Free TrialLog in
Avatar of raj3005
raj3005

asked on

datagrid onclick events

hi I have an issue with onclick event on a datagrid cell, after the data grid is populated is there any way i could know which row is clicked on the client side???
Avatar of Tonylmiller
Tonylmiller

This example selects the row that was clicked on if you put it in a mouseup event.

You can get the CurrentRowIndex of the datagrid.  Does this help?

myDataGrid.Select(myDataGrid.CurrentRowIndex);

Good luck!

Tony
My example is from a Windows form.  Are you doing a Windows or ASP app?
Avatar of raj3005

ASKER

tony its an asp page
ya, there is... your call to the onclick event should look something like this
myDG_OnClick(Object sender, DataGridCommandEventArgs E)
{

// E is now a the row that has been selected in the datagrid
//this will now create a textbox, so you can copy the 4th counting column in, where i have put for the sake of argument a textbox... this textbox that you have made is now the box that is in the column that was selected, and is the 4th thing in

Dim txtLastName As textbox = E.Item.cells(3).Controls(0)
}


i hope this makes sense... if not, you can always visit this... best site out there for asp.net questions on datagrids, in my opinion


http://www.aspnet101.com/aspnet101/aspnet/codesample.aspx?code=dgEdit

hope it helps,

Xen
ASKER CERTIFIED SOLUTION
Avatar of Aania
Aania

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial