hiii
I have two page in my adminitrator folder of my web site manageuser.aspx and userinformation.aspx .Now when i click at manage button at manageuser.aspx page i have to navigate userinformation.aspx page with corresponding user.
i set in the greed view of manageuser.aspx page-

<asp:HyperLinkField HeaderText="manage" 
                Text="manage" DataNavigateUrlFields="UserName" 
                DataNavigateUrlFormatString="UserInformation.aspx?user={0}"/>

and the coding of userinformation.aspx page is-

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
            ' If querystring value is missing, send the user to ManageUsers.aspx 
            Dim userName As String = Request.QueryString("user")
            If String.IsNullOrEmpty(userName) Then
                
                Response.Redirect("ManageUser.aspx")
            End If
            ' Get information about this user 
            Dim usr As MembershipUser = Membership.GetUser(userName)
            If usr Is Nothing Then
                Response.Redirect("ManageUser.aspx")
            End If
            UserNameLabel1.Text = usr.UserName
            IsApproved.Checked = usr.IsApproved
            If usr.LastLockoutDate.Year < 2000 Then
                LastLockoutDateLabel1.Text = String.Empty
            Else
                LastLockoutDateLabel1.Text = usr.LastLockoutDate.ToShortDateString()
                UnlockUserButton.Enabled = usr.IsLockedOut

            End If

        End If

    End Sub

the problem is string userName is always taking null value.

Set your DataKeyNames to your UserID then try code similar to this :
"EnableSelect=False"

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound


        If e.Row.RowType = DataControlRowType.DataRow Then
            e.Row.Attributes("onmouseover") = "this.style.cursor='hand';"
            e.Row.Attributes("onmouseout") = "this.style.textdecoration='none';"
            e.Row.Attributes("onclick") = Page.ClientScript.GetPostBackClientHyperlink(Me.GridView1, "Select$" + e.Row.RowIndex.ToString)

        End If
    end sub
 Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView1.SelectedIndexChanged

        HttpContext.Current.Response.Redirect("manageUser.aspx?id=" + Gridview1.SelectedIndex)
end sub

this snipit will allow you to click on your Row and it will automatically redirect you to your manage user for that UserID. hope this works for you let me know if you need more info or another solution.

the problem is string userName is always taking null value.

1: do you see "user" querystring parameter in the url in the status bar at the bottom of your browser, when you hover over the Manage link?
2: Did you set breakpoint and see if it is userName that is null or the asp.net membership user that is null?

Hello guru sarkar
first question's answer is-yes
and i m not getting the 2nd question.

--->first question's answer is-yes
Ok so your link is getting set properly, but when you click it something is going wrong correct? And so what is happening when you click it?

--->and i m not getting the 2nd question.
I meant set breakpoints inside of your userinformatin.aspx. See where is it breaking, i.e. is your userinformation not receiving "user" querystring or if user is not found in database or something else.

Helli frinds

Thanks
Now the problem has been solved.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.