Last post Jul 05, 2017 09:15 AM by Eric Du
Jul 04, 2017 11:42 AM|alihusain_77|LINK
I have the following:
<asp:TextBox ID="FromDateTxtBox" runat="server" Height="32px"
style="border:solid black 1px; font-family: 'sakkal Majalla'; font-size: 24px; text-align: right;" Width="150px"></asp:TextBox>
<asp:CalendarExtender ID="Calendar1" runat="server" Format="dd-MMMM-yyyy" PopupButtonID="imgPopup" TargetControlID="FromDateTxtBox">
In the Page_Load event, I have:
If IsPostBack = False Then
FromDateTxtBox.Text = Format("01-01-2013", "dd-MMMM-yyyy")
Calendar1.SelectedDate = CDate("01-01-2013")
The AutoPostBack property of FromDateTxtBox is set to
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?
Jul 05, 2017 09:15 AM|Eric Du|LINK
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]:
Save value in session:
Read value from session: