templatecolumn and row number

Discussion in 'ASP .Net Datagrid Control' started by rob merritt, Feb 17, 2004.

  1. rob merritt

    rob merritt Guest

    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>
     
    rob merritt, Feb 17, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jeff User
    Replies:
    0
    Views:
    443
    Jeff User
    Jan 2, 2006
  2. Chu
    Replies:
    0
    Views:
    513
  3. =?Utf-8?B?TXJDcm9vbA==?=

    Using TemplateColumn and DataGrid in code

    =?Utf-8?B?TXJDcm9vbA==?=, Aug 4, 2006, in forum: ASP .Net
    Replies:
    2
    Views:
    4,485
    =?Utf-8?B?TXJDcm9vbA==?=
    Aug 7, 2006
  4. D
    Replies:
    0
    Views:
    220
  5. Replies:
    1
    Views:
    135
Loading...

Share This Page