How to insert ID value of current record in GridView?
Hi there, I hope your appreciated help.
First of all I must say that I am a newbie when it comes to net language.
This is my problem.
How to insert ID value of current record in GridView in the querystring of protected void ImageButton1_Click?.
If you have link for similar task, please give it me.
Can you help me? thank you in advance.
Your help would be very appreciated
Thanks for your time and hints
This is my code:
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("http://mynetpage.com/default.aspx?cks=" + Request.Cookies["name"].Value + "");
}
<asp:SqlDataSource ID="SqlDataSource1" runat="server"....
<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" .....
..........
<asp:TemplateField HeaderText="M">
<ItemTemplate>
<asp:ImageButton ID="ImageButton1"
CommandName="Edit" runat="Server"
ImageUrl='<%# Eval("myState").ToString().Equals("validate") ? "/Images/Block.gif":"/Images/Edit.gif" %>'
ToolTip="Edit"
OnClientClick="return confirm('Confirm?.');"
Enabled='<%# Eval("myState").ToString() == "not validate" %>'
onclick="ImageButton1_Click" />
</ItemTemplate>
</asp:TemplateField>