I want to enable or disable 'ParticipateBtn' depending on EventStartDate. I am getting this error:Object reference not set to an instance of an object.
<table>
<tr>
<td align="right" style=" font-weight:bold">Start Date : </td>
<td><%# CheckEnability((DateTime)Eval("Event_Start_Date")) %></td>
</tr>
<asp:Button ID="ParticipateBtn" CommandName="Participate" CommandArgument='<%# Eval("Event_Id") + "|" + Eval("Event_Name") + "|" + Eval("Volume") + "|" + Eval("Tournament_Id") %>' runat="server" Text="Participate" />
</ItemTemplate>
<FooterTemplate></FooterTemplate>
<SeparatorTemplate><hr style="color:Silver; height:1px;" /></SeparatorTemplate>
</asp:Repeater>
//Code behind
protected string CheckEnability(DateTime eventstartdate)
{
if (eventstartdate.Date < DateTime.Now.Date)
{
Button btn = (Button)Repeater1.FindControl("ParticipateBtn");
btn.Enabled = false;
}
return eventstartdate.ToString("yyyy-MM-dd");
}