Chevy Mark Sunderland

Chevy Mark Sunderland

  • NA
  • 188
  • 166.6k

[C#] Comparing dates in GridView

Apr 16 2012 2:49 PM
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 disabled the asp image button "ImageButton4" when today's date is greater than the registration date in my database ?.

For example the record with date registration '2012-04-14' should not display the asp image button "ImageButton4".

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, EventArgs e)
{
ImageButton myButton = (ImageButton)sender;
string ID = myButton.CommandArgument.ToString();
Response.Redirect("http://localhost/WebApplication1/default.asp?id=" + ID + "&cks=" + Request.Cookies["MyCookie"].Value + "");

}


<ItemTemplate>
<asp:ImageButton ID="ImageButton4" CommandName="Redirect"
CommandArgument='<%#Eval("ID")%>' runat="server"
ImageUrl="/Images/updateDB.gif" ToolTip="Update DB"
OnClientClick="return confirm('Confirm?.');"
onclick="ImageButton1_Click" />
</ItemTemplate>

Answers (6)