templatecolumn and row number

R

rob merritt

I have a datagrid , that I populate using a template column with a
href around the data so when you click it it does a postback with the
index of the datagrid
index to operate on ie:

sub dgrid_update(s as object, e as
datagridcommandeventargs)

Session("username") = dgrid.datakeys(e.item.itemindex)

end sub



''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
sub dgrid_select(s as object, e as
datagridcommandeventargs)

Session("username") = dgrid.datakeys(e.item.itemindex)

end sub


so what I need to know is how do I get the row index of each row so I
can
change

a href="javascript:__doPostBack('dgrid$_ctl2$_ctl0','')">
to

a href="javascript:__doPostBack('dgrid$_ctl<%#
something%>$_ctl0','')">
or is there a better way to do this ?

<Columns>
<asp:TemplateColumn HeaderText="Found">
<ItemTemplate>
<table border="0">
<tr>
<td><a href="javascript:__doPostBack('dgrid$_ctl2$_ctl0','')"><%#
DataBinder.Eval(Container.DataItem, "lname") %> <%#
DataBinder.Eval(Container.DataItem, "fname")%> </a></td>
</tr>
</table>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid>
</Columns>
 

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

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,819
Latest member
masterdaster

Latest Threads

Top