hi
I wrote below codes in the page and called in Page Load event.
The Txtaz TextBox value is empty in page load.
private void GetEstatInfo(int pageIndex)
{
using (SqlConnection conn = General.GetConnection())
{
using (SqlCommand cmd = General.GetCommand("consultant_requestSearch", conn))
{
System.Globalization.PersianCalendar shamsi = new System.Globalization.PersianCalendar();
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@PageIndex", pageIndex);
cmd.Parameters.AddWithValue("@PageSize", PageSize);
cmd.Parameters.AddWithValue("@Request_type", Ddlreq.SelectedItem.Text);
cmd.Parameters.AddWithValue("@Consultant_name", Ddlmoshaver.SelectedItem.Text.Trim());
DateTime Dateaz = new DateTime(int.Parse(Txtaz.Text.Split('/')[0]), int.Parse(Txtaz.Text.Split('/')[1]), int.Parse(Txtaz.Text.Split('/')[2]), shamsi);
DateTime Dateta = new DateTime(int.Parse(Txtta.Text.Split('/')[0]), int.Parse(Txtta.Text.Split('/')[1]), int.Parse(Txtta.Text.Split('/')[2]), shamsi);
But below error occurs:
Server Error in '/' Application.
Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.FormatException: Input string was not in a correct format. Source Error:
Line 65: cmd.Parameters.AddWithValue("@Request_type", Ddlreq.SelectedItem.Text);
Line 66: cmd.Parameters.AddWithValue("@Consultant_name", Ddlmoshaver.SelectedItem.Text.Trim());
Line 67: DateTime Dateaz = new DateTime(int.Parse(Txtaz.Text.Split('/')[0]), int.Parse(Txtaz.Text.Split('/')[1]), int.Parse(Txtaz.Text.Split('/')[2]), shamsi);
Line 68: DateTime Dateta = new DateTime(int.Parse(Txtta.Text.Split('/')[0]), int.Parse(Txtta.Text.Split('/')[1]), int.Parse(Txtta.Text.Split('/')[2]), shamsi);
Line 69: //cmd.Parameters.AddWithValue("@txtaz", Txtta.Text);
|
can you help me?
Best regards
Neda