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 + "");
}
..........
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" />

SenthilkumarRank #387 · 6.5K reputationPosted Apr 12, 2012, 10:46 PM EDT
You can find this control in the row data bound event and you can add all the required attributes in it.
The server side you need to write this event.
On click on the image button, you can client side function.
function Validate()
{
if(confirm("Are you sure you want to edit/delete"))
{
window.location.href = "nextpage.aspx?";
}
}
Chevy Mark Sunderland159 reputationPosted Apr 13, 2012, 9:53 AM EDT
Veera Chenna26 reputationPosted Apr 16, 2012, 7:14 AM EDT
CommandName="Edit" runat="Server"
ImageUrl='<%# Eval("myState").ToString().Equals("validate") ? "/Images/Block.gif":"/Images/Edit.gif" + "?ID=" + Eval("ID") %>'
ToolTip="Edit"
OnClientClick="return confirm('Confirm?.');"
Enabled='<%# Eval("myState").ToString() == "not validate" %>'
onclick="ImageButton1_Click" />
Please refer to below links for more grid examples
http://technico.qnownow.com/2012/03/28/using-gridview-in-asp-net-c-part-2/
http://technico.qnownow.com/2012/04/09/display-images-from-database-in-asp-net-gridview-using-httphandler/
http://technico.qnownow.com/2012/03/30/custom-paging-in-asp-net-gridview-control/
Chevy Mark Sunderland159 reputationPosted Apr 16, 2012, 10:36 AM EDT