views:

72

answers:

1

Hello all

I have a gridfield which is being populated and in one of my cells the first there are hyperlinkfields. I need to know if it is possible to get the rownumber of the hyperlinkfield just like it is with a buttonfield. Unfortunately I cannot use a buttonfield else my problem would have been solved. I cannot find an event associated with the hyperlinkfield and it is also not doing any postbacks if I recall the info correctly. If this is possible how do I achieve this ?

as requested the edit:

Protected Sub objGridView_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs)

 Dim strProID As String
    If e.CommandName = "Select" Then
        Dim index As Integer = Convert.ToInt32(e.CommandArgument)
        RowNR = index
    End If
       SelectedID = RowNR
    Response.Write("<script>document.location.href = " & "('SelectedTask.aspx');</script>") 'windows.navigate doesn't work in firefox and several other browsers
End Sub

This was my code when i used a linkbutton. The linkbutton from the gridview has an attribute commandname and you can use this so your event will be raised. Which I did. Unfortunately for the hyperlinkview cell does not have such a property. So I can't raise an event and see which rownumber i selected if I click on one of my with hyperlinkfilled cells.

edit: So I fixed my problem with just a simple DataNavigateFormatString.
I know foolish of me to not get there sooner, but better late then never.

Why mess around with the rownumber to get the value from my cell, if I can get the value much cleaner , quicker and without postbacks;).

A: 

Try to achieve using "OnSelectedIndexChanging". This should help you.

Saar
sorry but this event isn't triggered with my current code
jovany
@jovany: please paste GridView code from aspx file
Saar
I fixed it with the HyperlinkField and the DataNavigateUrlFormatStringI'll edit my post for clarity.
jovany