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" />
SenthilkumarPosted Apr 13, 2012, 2:46 AM
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 SunderlandPosted Apr 16, 2012, 2:36 PM
Veera ChennaPosted Apr 16, 2012, 11:14 AM
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 SunderlandPosted Apr 13, 2012, 1:53 PM