Tuesday, January 31, 2012

Working with Ajax Calender Extender with dd/mm/yyyy Validation

CalendarExtendar

Hi friends,In this article i would like to explain "How to use Ajax calendar Extender in Asp.Net applications" .Here we are displaying date in dd/mm/yyyy Format.First we need to add AjaxControlToolkit to your
Application.click here to know the procedure of adding Ajax Toolkit to your applications.

Open the Default.aspx and select one Textbox from Toolbox and write the following code



 



Next apply the Regular and Required Field validations for

*
                    
 * 


Now,the Date will be display in dd/mm/yyyy Format.When we are inserting date in database we need to change in MM/dd/yyyy Format.
write the following code to change the date

string[] RawDate = txtDate.Text.Split('/');
string[] datearr = { RawDate[1], RawDate[0], RawDate[2] };
string date = datearr[0] + "/" + datearr[1] + "/" + datearr[2];


That's it...

Labels: , , , , , , ,

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home