how to change the selectindex of the grid to the clicked row..

liunx

Guest
hai there

so let me tell u what i am actually

trying to do......
i have two tables,both are related
so when i am clicking on the row of

parent table i want my application to

show the child table details......

so the problem i am facing is i am

finding no event related to the grid

click

but there is some thing i know there

is a property ... of grid
SELECTINDEX ....
-------------------------------
code:in c#
----------------------------------
Datagridname.Item[Datagridname.Select

Index].Cell[3].Text.Trim

------------------------------------

using this i can retive the value of any element of the selected row of the tabel

and one more thing i know
-------------------------------
code:in c#
in the event handler of any button
----------------------------------
Datagridname.SelctIndex++;
------------------------------------

the above code will make the next row

in the grid as selected one
but the problem is that in such

manner u need to move rows one by one


so all i want to set

Datagridname.SelctIndex=

to the currently clicked row....

can you help.........


thanking all

austinYou can't. Not with asp.net. The data grid control outputs an html <table>. So if the user is clicking on a row <tr> he is clicking on an element which is not going to resend the page to the server and therefore you can't really do anything. You might be better off using a link with a query string in order to get a variable back to the server (as I said in another post).set itemcommand subroutine in datagrid tag as follows.
<asp:DataGrid OnItemCommand="Display">

In code behind from subroutine display u can access the row as follows
Public Sub Display(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Dim id As Integer
id = e.Item.ItemIndex(this gives the index of the clicked row)
end sub
 
Back
Top