i want the user to select the date from calendar and then display the excel record into database.
In run mode as follows
In run mode as follows
Fromdate calendar1 Todate calendar2 Import(Button)
I want the user to select the Fromdate and Todate
And then click the Import(Button).
Then excel record is displayed in the Gridview.
Suppose when user did not select the from date and todate,and click the Import button.
Then i want to display the message "Please select the From date and To Date"
for that how can i validate in asp.net using c#.
Pradeep ShetPosted Aug 21, 2014, 5:18 PM
Which calender control have you used it?
if you are using calender control of asp.net then you have the property of calendercontrol
calender1.SelectedDate
Check for this date, whether it is blank or not.Based on it show alter message which you wish to show. I don't know exactly whether you were looking for this ans but I will share sample code for your reference
if(!fromdate.SelectedDate.ToString().Equals(string.Empty)
|| !todate.SelectedDate.ToString().Equals(string.Empty))
{
//For showing in label
Label1.Text = "Please select the From date and To Date";
//For showing in javascript alert box
ClientScript.RegisterStartupScript(this.GetType(), "mymsg", "alert('Please select the From date and To Date');", true);
}
Hope this helps you. If it is so please mark it as answered