I have a ascx control that contains a popup radWindow which contains a datalist that is populated at the time the ascx is loaded on the page. A button displays the radWindow with the preloaded values in a template, which contains an editable textbox on each row. When the window is hidden, the textbox values should persist in the hidden window until the Save button on the main page is pressed saving the entire page, plus the values in the hidden radWindow.
When I load the page, and open the radWindow for the first time, the previously saved values are displayed in their respective textboxes. If I then press OK to hide the window, then immediately reopen it, the values in the VISIBLE textbox are gone. The values in the label control and the HIDDEN textbox are retained.
If when I open the window for the first time with the original values present, then change any one of the visible text boxes, then close and immediately reopen, all my values are retained, including the preloaded values plus any edits. I can now open and close as many times as I want without changing any data values and not lose any values in the visible textboxes.
If I change the hidden textbox to visible, it also loses its values as in the above scenario. If I change the visible textbox to hidden, it retains its values in all scenarios. The label in the <itemtemplate> doesn't seem to be affected.
If I navigate to the page, which prepopulates the datalist in the radWindow, and DO NOT open the window, then press save on the main page, I also lose the values in the Visible Textbox.
So, it appears that when a textbox is visible in the window, it does not persist its values, unless something has changed. Not sure why it will show the values when the window opens for the first time and not show them on any subsequent open. I have tweaked several settings on the radWindow control to no avail. This is happening in multiple browsers (Chrome, IE, Edge), so not isolated to browser type. I am curious what is triggered when a value is changed to suddenly persist the values in the VISIBLE text boxes, why the textboxes do not seem to have persisted values when they are visible, regardless if the window is opened or not.
I converted this from another third-party window control and it worked perfectly. Since we are now using Telerik, it necessitated the change. The only changes I made to the sourcecode was the javascript function that opens the radWindow in the 'onclick' event and the <telerik:windowmanager> tag, down the to the <ContentTemplate> wrapper tags. Everything contained between the ContentTemplate tags is exactly the same, essentially reproducing the previous window controls behavior, with the exception of this issue.
Thoughts?!?
Button that opens the window:
<input type="button" class="command_button" value="..." onclick="javascript: window.radopen(null, 'radPreWin');" />
Window:
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
<Windows>
<telerik:RadWindow ID="radPreWin" runat="server" Title="Pre-XXXX Funding" Height="400px"
Width="300px" Left="150px" ReloadOnShow="true" Modal="true" DestroyOnClose="false">
<ContentTemplate>
<center>
<br />
<table>
<tr>
<td valign="top" colspan="2" width="100%">
<asp:HiddenField ID="hidPreFundArr" runat="server" />
<asp:datalist id="dlstPreFundList" runat="server" RepeatDirection="vertical" EnableViewState="true" Height="200"
cellpadding="0" cellspacing="0">
<itemtemplate>
<asp:label ID="lblPreFundYear" Width="66" Runat="server" CssClass="standard-text-small">
<%# DataBinder.Eval(Container, "DataItem.CP_Funding_Year_Text") %>
</asp:label>
<asp:TextBox ID="txtPreFundYear" Runat="server" Visible="false" CssClass="standard-text" Columns="15" Text='<%# DataBinder.Eval(Container, "DataItem.CP_Funding_Year") %>'>
</asp:TextBox>
<asp:TextBox ID="txtPreFundingAmount" Runat="server" Visible="true" CssClass='standard-text' ReadOnly='<%#IIf(mbIsReadOnly, "True", "False") %>' TabIndex="20" Columns="15" Text='<%# Format(DataBinder.Eval(Container, "DataItem.CP_Funding_Amount"), "#,###") %>'>
</asp:TextBox>
<asp:comparevalidator ID="txtPreFundingAmountValidator" ControlToValidate="txtPreFundingAmount" Type="Currency" Operator="DataTypeCheck" Display="Dynamic" EnableClientScript="false" ErrorMessage="The funding amount must be numeric." runat="server" />
</itemtemplate>
</asp:datalist></td>
</tr>
<tr>
<td valign="middle" align="right" width="110">
<asp:label id="lblPreFund" CssClass="standard-bold" Runat="server">Sub Total </asp:label>
</td>
<td valign="middle" align="left" width="140">
<asp:textbox id="txtPreFundingTotal" tabIndex="15" CssClass="standard-text-gray" Runat="server" Columns="15" ReadOnly="true" AutoPostBack="false"></asp:textbox>
<asp:comparevalidator ID="Comparevalidator1" ControlToValidate="txtPreFundingTotal" Type="Currency" Operator="DataTypeCheck" Display="Dynamic" EnableClientScript="false" ErrorMessage="The Funding Amount must be numeric." runat="server" />
</td>
</tr>
<tr>
<td colspan="2" align="center">
<br />
<asp:Button ID="cmdOK" runat="server" Text="OK" CssClass="command_button" Visible="true" OnClientClick="javascript:WindowClose();" />
</td>
</tr>
</table>
</center>
</ContentTemplate>
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
Javascript function that hides the window when "OK" is pressed:
function WindowClose()
{
var oWindow = $find("<%= radPreWin.ClientID %>");
oWindow.hide();
}