I am using an asp.net ImageButton for post back url. In
user.aspx
page there are images of other users within a datalist.
I want when I click any of those pictures the selected user s details should display on the user page. What do I have to do for that.
In my
ImageButton
I use post back url like this
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl='<%# GetImageURL(Eval("Pic")) %>' PostBackUrl='<%# Eval("id", "user.aspx?id={0}") %>'/>
and in page load code
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs)
If Session("UName") Is Nothing Then
Response.Redirect("login.aspx")
Else
If Not (IsPostBack) Then
binddata()
binddata1()
binddata2()
End If
End If
End Sub
and use query string on databind like this
Sub binddata()
Dim mycommand As New SqlCommand("SELECT * FROM details where id = @id", con)
mycommand.Parameters.Add("@id", SqlDbType.Int)
mycommand.Parameters("@id").Value = Convert.ToInt32(Request.QueryString("id"))
con.Open()
userData.DataSource = mycommand.ExecuteReader
userData.DataBind()
con.Close()
End Sub
but it is not working. I am not able to catch where I am going wrong. Please help me with this.
[edit] - formatted code blocks and some minor grammer changes