954,595 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

How to get auto calculated expiry date on lost focus event of registration date

Hello There,

I am working with c# & I have used two textbox server control.
1> Registration Date
2> Expiry Date
First of all, user enters value for the first textbox namely Registration Date and then the expiry date should be auto calculated by adding 30 days into currently entered registration date when he user leaves the first textbox.

That means there are two textboxes - user enters the value for first textbox and the second textbox should be auto calcuated on lost focus event of first textbox.
So pls let me know..... Waiting for your answer....

Thanks,
Paresh

Attachments expirydate_original_pic.jpg 41.86KB
frmsasp
Newbie Poster
8 posts since Sep 2005
Reputation Points: 10
Solved Threads: 0
 

Dear friend,

There are two ways of doing it. One on the client side and the other one is server side.

On client side, you javascript's method Onblur event of textBox and call a javascript method that gets value from one TextBox and sets the value in second one. So the code like following:

and in head section of page add:

on server side you can do it easily by adding an event handler, or by just calling post back to page on OnBlur Event by calling __doPostBack('','');

and on server side do expire.Value = DateTime.Parse(register.Value).AddDaye(30).ToShortString();

Hope this helps

v_ashwani
Newbie Poster
5 posts since Oct 2005
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You