If IsPostBack = False Then
.
.
.
FromDateTxtBox.Text = Format("01-01-2013", "dd-MMMM-yyyy")
Calendar1.SelectedDate = CDate("01-01-2013")
.
.
.
End If
The AutoPostBack property of FromDateTxtBox is set to
False
The problem I have is that any action I made in the page that makes the page to be postback (Button, DropDownList, Gridview radio button,....) causes the text value of the FromDateTxtBox to its initial value, which means losing the value entered by the user.
According to your description, as far as I know, if you postback the page, the page control will be initialized.
So I think you could use session or hidden element to store the value, after the postback, you could get data from session then show it in the textbox.
How to maintain the value of label after postback in Asp.net? [closed]:
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.
Member
42 Points
573 Posts
ModalPopupExtender textbox always reset to its initial values
Jul 04, 2017 11:42 AM|alihusain_77|LINK
I have the following:
In the Page_Load event, I have:
The AutoPostBack property of FromDateTxtBox is set to False
The problem I have is that any action I made in the page that makes the page to be postback (Button, DropDownList, Gridview radio button,....) causes the text value of the FromDateTxtBox to its initial value, which means losing the value entered by the user.
Thus, How can I prevent this behavior?
Contributor
6420 Points
2687 Posts
Re: ModalPopupExtender textbox always reset to its initial values
Jul 05, 2017 09:15 AM|Eric Du|LINK
Hi alihusain_77,
According to your description, as far as I know, if you postback the page, the page control will be initialized.
So I think you could use session or hidden element to store the value, after the postback, you could get data from session then show it in the textbox.
How to maintain the value of label after postback in Asp.net? [closed]:
https://stackoverflow.com/questions/20907112/how-to-maintain-the-value-of-label-after-postback-in-asp-net
Save value in session:
https://msdn.microsoft.com/en-us/library/6ad7zeeb.aspx
Read value from session:
https://msdn.microsoft.com/en-us/library/03sekbw5.aspx
Best Regards,
Eric Du
Please remember to click "Mark as Answer" the responses that resolved your issue.
If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.