Click here to Skip to main content
15,884,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi


I am Unable to Retrieve Date in Textbox(Joining Date Textbox)


Here the Code

Aspx File

XML
<div class="form-grou">
                               <asp:Label ID="Date_Of_Birth_Label" runat="server" CssClass="col-lg-4 control-label" Text="Date Of Birth"></asp:Label>
                               <div class="col-lg-8">
                                   <asp:TextBox ID="Date_Of_Birth_TextBox" runat="server" CssClass="form-control"></asp:TextBox>
                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator5" ControlToValidate="Date_Of_Birth_TextBox" runat="server" ForeColor="Red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="Date Of Birth Is Mandatory"></asp:RequiredFieldValidator>

                               </div>
                           </div>

                           <div class="form-grou">
                               <asp:Label ID="Email_Address_Label" runat="server" CssClass="col-lg-4 control-label" Text="Email Address"></asp:Label>

                               <div class="col-lg-8">
                                   <asp:TextBox ID="Email_Address_TextBox" runat="server"  TextMode="Email" CssClass="form-control"></asp:TextBox>
                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator4" ControlToValidate="Email_Address_TextBox" runat="server" ForeColor="Red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="Email Address Is Mandatory"></asp:RequiredFieldValidator>
                               </div>

                           </div>


                           <div class="form-grou">
                               <asp:Label ID="Contact_No_Label" runat="server" CssClass="col-lg-4 control-label" Text="Phone No"></asp:Label>

                               <div class="col-lg-8">
                                   <asp:TextBox ID="Contact_No_TextBox" MaxLength="10"  onkeypress='return event.charCode >=48 && event.charCode <=57' runat="server"  Text="0" CssClass="form-control"></asp:TextBox>
                               </div>

                           </div>


                           <div class="form-grou">
                               <asp:Label ID="Joining_Date_Label" runat="server" CssClass="col-lg-4 control-label" Text="Joining Date"></asp:Label>

                               <div class="col-lg-8">
                                   <asp:TextBox ID="Joining_Date_TextBox" TextMode="Date" runat="server" CssClass="form-control"></asp:TextBox>


                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator7" ControlToValidate="Joining_Date_TextBox" runat="server" ForeColor="Red" Display="Dynamic" SetFocusOnError="true" ErrorMessage="Joining Date Mandatory"></asp:RequiredFieldValidator>
                               </div>

                           </div

>

aspx.cs



string Connection_string = System.Configuration.ConfigurationManager.ConnectionStrings["CMMS_Standard"].ToString();

byte Employee_Tittle = 0;
Int16 Created_by_Employee_Id = 0;
byte Employee_Designation_ID = 0;
Int16 Employee_Id = 0;
byte Deparment_id = 0;
string Id = "";

protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["E_Id"] != null)
{
string Username = User.Identity.Name;
Employee_Detail Employee_Detail_Class = new Employee_Detail();
Employee_Detail_Class.Retrieve_User_Id(ref Connection_string, ref Username, out Created_by_Employee_Id);


Id = Request.QueryString["E_Id"];
Employee_Id = Convert.ToInt16(Employees_detail_id_code.retrive_id(Id));

if (!IsPostBack)
{
Load_Designation();

DataTable dt;


Employee_Detail_Class.Retrieve_Employee_Details_By_Id(ref Connection_string, ref Employee_Id, out dt);

if (dt.Rows.Count > 0)
{



Date_Of_Birth_TextBox.Text = Convert.ToDateTime(dt.Rows[0]["Employee_DOB"]).ToString("dd-MM-yyyy");


Joining_Date_TextBox.Text = Convert.ToDateTime(dt.Rows[0]["Employee_Joining_Date"]).ToString("dd/MM/yyyy");


}
}


}
else
{
Response.Redirect("~/Error.aspx");
}


In Date Of Birth TextBox I retrive Date , But in Joining Date I am Unable to retrieve Date . I use textmode date , Please help How I retreive date with Textmode date Property
Posted
Updated 9-Apr-15 23:51pm
v3
Comments
BulletVictim 10-Apr-15 5:30am    
Please Do not post all your code, Please only post the code relative to your problem
Gurpreet Arora Malhotra 10-Apr-15 5:34am    
k

1 solution

Just try with YYYY-MM-DD format
 
Share this answer
 
Comments
Gurpreet Arora Malhotra 10-Apr-15 5:59am    
Pleasse give me Example
Gurpreet Arora Malhotra 10-Apr-15 6:04am    
I try to change the format but still not working
Gurpreet Arora Malhotra 10-Apr-15 7:02am    
i try yyyy-MM-dd Its working Thank You

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900