How do I handle this error : No overload for 'SQLDisplay_Date_records' matches delegate 'System.EventHandler'
So I basically have two textboxes in the aspx file which get populated by dates (using the jquery datepicker) as given below
Start Date: <asp:TextBox ID="TxtDatepicker_start" runat="server" Width = 125px >
  </asp:TextBox>
    End Date: <asp:TextBox ID="TxtDatepicker_end" runat="server" Width = 125px >
  </asp:TextBox>
      <asp:Button ID="Button_daterecords" runat="server"  Text="Show records"  OnClick ="SQLDisplay_Date_records" /><br />
However when I try to determine what has been stored in the text boxes for further processing in the code behind using this function
protected void SQLDisplay_Date_records()
        {
            string date1 = TxtDatepicker_end.Text;
            string date2 = TxtDatepicker_end.Text;
        }
I am getting this error
No overload for 'SQLDisplay_Date_records' matches delegate 'System.EventHandler'
Can someone explain this to me ,I apologize fo开发者_JAVA百科r the naive question but I am still making my way around with ASP.NET and C#
Wild guess, OnClick is a event. which has a object (source) and eventargs.
Try setting it to
Protected void SQLDisplay_Date_records(object sender, EventArgs e)
{
    string date 1 = TxtDatepicker_end.Text;
    string date 2 = TxtDatepicker_end.Text;
}
Your method signature is incorrect.
The protected void SQLDisplay_Date_records()
should be protected void SQLDisplay_Date_records(object sender, EventArgs e)
As it is an OnClick Event and it should take an Event Argument as a parameter.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论