This is a migrated thread and some comments may be shown as answers.

RadCheckBox issue resets FileUpload

1 Answer 107 Views
CheckBox
This is a migrated thread and some comments may be shown as answers.
Mohamed
Top achievements
Rank 1
Mohamed asked on 05 Feb 2018, 01:22 PM

Hi,

I am having a difficulty with RadCheckBox that whenever i check or uncheck a checkbox, all fields maintain their data (viewstate) except my fileupload control that resets to empty. I have tried Ajax asyncFileUpload and I have tried RadAsyncUpload controls but they behave the same when I check or uncheck a RadCheckBox. The controls are all in RadWindow and then in RadAjaxPanel. Plus the Checkbox that I am checking has no autopostback set, e.g. "chkIsComingled" and the FileUpload controls that are resetting are "uplProductionLine" and "uplGasLine"

 

 

I am attaching the HTML for this part below.

 

 

<telerik:RadWindow runat="server" ID="rdWinNewWell" Modal="True" Width="880px" AutoSize="true" AutoSizeBehaviors="Height" Title="New Well">
                                <ContentTemplate>
                                    <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
                                        <div>&nbsp;</div>
                                        <div>
                                            <table class="table myTable">
                                                <thead>
                                                    <tr>
                                                        <th colspan="4">Well Info
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>Well (*)</td>
                                                        <td>
                                                            <telerik:RadComboBox RenderMode="Lightweight" ID="cmbWells" runat="server" Width="200px" Height="400px"
                                                                EmptyMessage="Type or Select a Well" DataValueField="API_CD" DataTextField="COMP_NAME"
                                                                MarkFirstMatch="true" OnSelectedIndexChanged="cmbWells_SelectedIndexChanged" AutoPostBack="true">
                                                            </telerik:RadComboBox>
                                                            <telerik:RadCheckBox ID="chkShowComingWells" runat="server" Text="" AutoPostBack="true" OnCheckedChanged="chkShowComingWells_CheckedChanged"></telerik:RadCheckBox>                                                            
                                                        </td>
                                                        <td>Field</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtField" runat="server" Text="" Enabled="false"></telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Location</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtLocation" runat="server" Text="" Enabled="false"></telerik:RadTextBox>
                                                        </td>
                                                        <td>Type</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtWellType" runat="server" Text="" Enabled="false"></telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>MOP</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtWellMOP" runat="server" Text="" Enabled="false"></telerik:RadTextBox>
                                                        </td>
                                                        <td>Spud Date</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtExpetedSpud" runat="server" Text="" Enabled="false"></telerik:RadTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Expected Oil (*)</td>
                                                        <td>
                                                            <telerik:RadNumericTextBox RenderMode="Lightweight" ID="txtExpectedOil" runat="server" Type="Number" NumberFormat-DecimalDigits="3"></telerik:RadNumericTextBox>
                                                        </td>
                                                        <td>Is Water Injector?</td>
                                                        <td>
                                                            <telerik:RadCheckBox ID="chkIsWaterInjector" runat="server" Text="" OnClientCheckedChanged="disableForm" AutoPostBack="false"></telerik:RadCheckBox>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div>
                                            <table class="table myTable">
                                                <thead>
                                                    <tr>
                                                        <th colspan="4">Production Flow Line
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>Stations
                                                        </td>
                                                        <td colspan="3">
                                                            <telerik:RadComboBox RenderMode="Lightweight" ID="cmbStationsOfManifolds" runat="server"
                                                                EmptyMessage="Filter by Station" DataValueField="LOOKUP_CODE" DataTextField="LOOKUP_TEXT"
                                                                OnSelectedIndexChanged="cmbStationsOfManifolds_SelectedIndexChanged" AutoPostBack="true">
                                                            </telerik:RadComboBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Manifold (*)</td>
                                                        <td>
                                                            <telerik:RadComboBox RenderMode="Lightweight" ID="cmbManifolds" runat="server" Width="300px" Height="400px" DropDownWidth="300px"
                                                                EmptyMessage="Type or Select a Manifold" MarkFirstMatch="true" OnSelectedIndexChanged="cmbManifolds_SelectedIndexChanged" AutoPostBack="true">
                                                                <HeaderTemplate>
                                                                    <table style="width: 265px" cellspacing="0" cellpadding="0">
                                                                        <tr>
                                                                            <td style="width: 175px;">Manifold Name
                                                                            </td>
                                                                            <td style="width: 70px;">Dist. m
                                                                            </td>
                                                                            <td style="width: 70px;">Avl. Slots
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <table style="width: 265px" cellspacing="0" cellpadding="0">
                                                                        <tr>
                                                                            <td style="width: 175px;">
                                                                                <%# DataBinder.Eval(Container, "Text")%>
                                                                            </td>
                                                                            <td style="width: 70px;">
                                                                                <%# DataBinder.Eval(Container, "Attributes['MANIFOLD_DISTANCE_DB']")%>
                                                                            </td>
                                                                            <td style="width: 70px;">
                                                                                <%# DataBinder.Eval(Container, "Attributes['AVAILABLE_SLOTS']")%>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </ItemTemplate>
                                                            </telerik:RadComboBox>
                                                        </td>
                                                        <td>Slots</td>
                                                        <td>
                                                            <telerik:RadComboBox RenderMode="Lightweight" ID="cmbSlot" runat="server" Width="200px" DropDownWidth="200px"
                                                                EmptyMessage="Type or Select a Slot #" MarkFirstMatch="true">
                                                                <HeaderTemplate>
                                                                    <table style="width: 160px" cellspacing="0" cellpadding="0">
                                                                        <tr>
                                                                            <td style="width: 60px;">Slot #
                                                                            </td>
                                                                            <td style="width: 100px;">Status
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </HeaderTemplate>
                                                                <ItemTemplate>
                                                                    <table style="width: 160px" cellspacing="0" cellpadding="0">
                                                                        <tr>
                                                                            <td style="width: 60px;">
                                                                                <%# DataBinder.Eval(Container, "Text")%>
                                                                            </td>
                                                                            <td style="width: 100px;">
                                                                                <%# DataBinder.Eval(Container, "Attributes['STATUS']")%>
                                                                            </td>
                                                                        </tr>
                                                                    </table>
                                                                </ItemTemplate>
                                                            </telerik:RadComboBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Comingled?</td>
                                                        <td>
                                                            <telerik:RadCheckBox ID="chkIsComingled" runat="server" Text=""></telerik:RadCheckBox>
                                                        </td>
                                                        <td>Comingled At
                                                        </td>
                                                        <td>
                                                            <telerik:RadComboBox RenderMode="Lightweight" ID="cmbComingleType" runat="server" Width="200px"
                                                                EmptyMessage="Select Comingle Type" DataValueField="LOOKUP_CODE" DataTextField="LOOKUP_TEXT">
                                                            </telerik:RadComboBox>
                                                            <i class="fa fa-info-circle" aria-hidden="true" id="infoComingleType" runat="server"></i>
                                                            <telerik:RadToolTip RenderMode="Lightweight" ID="tltComingleType" runat="server" TargetControlID="infoComingleType" RelativeTo="Element"
                                                                Position="TopLeft" RenderInPageRoot="true" AutoCloseDelay="0">
                                                                <p><b>At Line:</b> The well is comingled at flow line.</p>
                                                                <p><b>At Manifold:</b> The well is comingled in the station near manifold.</p>
                                                            </telerik:RadToolTip>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Estimated Length (*)</td>
                                                        <td>
                                                            <telerik:RadNumericTextBox RenderMode="Lightweight" ID="txtEstimatedLengthProd" runat="server" EmptyMessage="Meters" Width="80px"
                                                                Type="Number" NumberFormat-DecimalDigits="3">
                                                            </telerik:RadNumericTextBox>
                                                            Actual Length
                                                            <telerik:RadNumericTextBox RenderMode="Lightweight" ID="txtActualLengthProd" runat="server" EmptyMessage="Meters" Width="80px"
                                                                Type="Number" NumberFormat-DecimalDigits="3">
                                                            </telerik:RadNumericTextBox>
                                                        </td>
                                                        <td>Size (*)</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtEstimatedSizeProd" runat="server" Enabled="false"></telerik:RadTextBox>
                                                            <telerik:RadButton ID="btnMultiSizes" runat="server" Text="Select ..." OnClick="btnMultiSizes_Click">
                                                                <Icon PrimaryIconCssClass="rbConfig" />
                                                            </telerik:RadButton>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Temperature (*)</td>
                                                        <td>
                                                            <telerik:RadNumericTextBox RenderMode="Lightweight" ID="txtTemperature" runat="server" EmptyMessage="°F"
                                                                Type="Number" NumberFormat-DecimalDigits="3">
                                                            </telerik:RadNumericTextBox>
                                                        </td>
                                                        <td>Pressure (*)</td>
                                                        <td>
                                                            <telerik:RadNumericTextBox RenderMode="Lightweight" ID="txtPressure" runat="server" EmptyMessage="PSI"
                                                                Type="Number" NumberFormat-DecimalDigits="3">
                                                            </telerik:RadNumericTextBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4">
                                                            <div class="MyAttach">
                                                                <span>Attachment</span>
                                                                <span>
                                                                    <asp:FileUpload ID="uplProductionLine" runat="server" onchange="setImageThumbProd(this);" />                                                                    
                                                                </span>
                                                                <span>
                                                                    <img id="imgThumbProd" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="Image" />
                                                                </span>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div>
                                            <table class="table myTable">
                                                <thead>
                                                    <tr>
                                                        <th colspan="4">Gas Lift Line
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>Estimated Length</td>
                                                        <td>
                                                            <telerik:RadNumericTextBox RenderMode="Lightweight" ID="txtEstimatedLengthGas" runat="server" EmptyMessage="Meters" Width="80px"
                                                                Type="Number" NumberFormat-DecimalDigits="3">
                                                            </telerik:RadNumericTextBox>
                                                            Actual Length
                                                            <telerik:RadNumericTextBox RenderMode="Lightweight" ID="txtActualLengthGas" runat="server" EmptyMessage="Meters" Width="80px"
                                                                Type="Number" NumberFormat-DecimalDigits="3">
                                                            </telerik:RadNumericTextBox>
                                                        </td>
                                                        <td>Size</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtEstimatedSizeGas" runat="server" Enabled="false"></telerik:RadTextBox>
                                                            <telerik:RadButton ID="btnMultiSizesGas" runat="server" Text="Select ..." OnClick="btnMultiSizesGas_Click">
                                                                <Icon PrimaryIconCssClass="rbConfig" />
                                                            </telerik:RadButton>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Comments</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtGasLineComments" runat="server" TextMode="MultiLine" Rows="2" Width="250px" MaxLength="499"></telerik:RadTextBox>
                                                        </td>
                                                        <td colspan="2">
                                                            <telerik:RadCheckBox ID="chkIsShutinRequired" runat="server" Text="Is well shut-in required?"></telerik:RadCheckBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td colspan="4">
                                                            <div class="MyAttach">
                                                                <span>Attachment</span>
                                                                <span>
                                                                    <asp:FileUpload ID="uplGasLine" runat="server" onchange="setImageThumbGas(this);" />
                                                                </span>
                                                                <span>
                                                                    <img id="imgThumbGas" src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" alt="Image" />
                                                                </span>
                                                            </div>
                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div>
                                            <table class="table myTable">
                                                <thead>
                                                    <tr>
                                                        <th colspan="4">Connection Information
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td>Start</td>
                                                        <td>
                                                            <telerik:RadDatePicker RenderMode="Lightweight" ID="dtpStartDate" Width="250px" runat="server" MaxDate="12-31-9999" DateInput-EmptyMessage="Pick Start Date"></telerik:RadDatePicker>
                                                        </td>
                                                        <td>End</td>
                                                        <td>
                                                            <telerik:RadDatePicker RenderMode="Lightweight" ID="dtpEndDate" Width="150px" runat="server" MaxDate="12-31-9999" DateInput-EmptyMessage="Pick End Date"></telerik:RadDatePicker>
                                                            <telerik:RadCheckBox ID="chkInfiniteEnd" runat="server" Text="Infinite" OnClientCheckedChanged="setEndDate" AutoPostBack="false"></telerik:RadCheckBox>
                                                        </td>
                                                    </tr>
                                                    <tr>
                                                        <td>Status</td>
                                                        <td>
                                                            <telerik:RadComboBox RenderMode="Lightweight" ID="cmbStatus" runat="server" Width="250px"
                                                                EmptyMessage="Type or Select Status" DataValueField="STATUS_VALUE" DataTextField="STATUS_TEXT"
                                                                MarkFirstMatch="true">
                                                            </telerik:RadComboBox>
                                                        </td>
                                                        <td>FLAS Comments</td>
                                                        <td>
                                                            <telerik:RadTextBox RenderMode="Lightweight" ID="txtFLASComments" runat="server" TextMode="MultiLine" Rows="2" Width="250px" MaxLength="499"></telerik:RadTextBox></td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div>
                                            <table class="table myTable">
                                                <thead>
                                                    <tr>
                                                        <th colspan="4">History
                                                        </th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <tr>
                                                        <td colspan="4">
                                                            <telerik:RadGrid RenderMode="Lightweight" ID="rdgWFHistory" runat="server" ShowStatusBar="true" AutoGenerateColumns="False"
                                                                AllowSorting="True" AllowMultiRowSelection="False" AllowPaging="True" PageSize="2" OnNeedDataSource="rdgWFHistory_NeedDataSource">
                                                                <PagerStyle Mode="NumericPages"></PagerStyle>
                                                                <MasterTableView>
                                                                    <Columns>
                                                                        <telerik:GridBoundColumn SortExpression="CREATED_DT" HeaderText="Date" HeaderButtonType="TextButton"
                                                                            DataField="CREATED_DT">
                                                                        </telerik:GridBoundColumn>
                                                                        <telerik:GridBoundColumn SortExpression="REVIEWED_BY" HeaderText="Reviewed By" HeaderButtonType="TextButton"
                                                                            DataField="REVIEWED_BY">
                                                                        </telerik:GridBoundColumn>
                                                                        <telerik:GridBoundColumn SortExpression="REVIEWER_INFO" HeaderText="Reviewer Info" HeaderButtonType="TextButton"
                                                                            DataField="REVIEWER_INFO">
                                                                        </telerik:GridBoundColumn>
                                                                        <telerik:GridBoundColumn SortExpression="STATUS" HeaderText="Status" HeaderButtonType="TextButton"
                                                                            DataField="STATUS">
                                                                        </telerik:GridBoundColumn>
                                                                        <telerik:GridBoundColumn SortExpression="COMMENTS" HeaderText="Comments" HeaderButtonType="TextButton"
                                                                            DataField="COMMENTS">
                                                                        </telerik:GridBoundColumn>
                                                                    </Columns>
                                                                </MasterTableView>
                                                            </telerik:RadGrid>

                                                        </td>
                                                    </tr>
                                                </tbody>
                                            </table>
                                        </div>
                                        <div style="text-align: center;">
                                            <asp:Label ID="lblPermissionMSG" Text="" runat="server" ForeColor="Red" />
                                            <br />
                                            <telerik:RadButton ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click">
                                                <Icon PrimaryIconCssClass="rbOk" />
                                            </telerik:RadButton>
                                            <telerik:RadButton ID="btnCancel" runat="server" Text="Close" OnClientClicked="function(button, args){closeRadWin(button, args, 'rdWinNewWell');}">
                                                <Icon PrimaryIconCssClass="rbCancel" />
                                            </telerik:RadButton>
                                        </div>
                                        <telerik:RadNotification RenderMode="Lightweight" ID="ntfMessage" runat="server" Position="BottomRight"
                                            AutoCloseDelay="6000" Width="350" Height="200" EnableShadow="true" Animation="Fade" Title="Title"
                                            EnableRoundedCorners="true" TitleIcon="none" ContentIcon="~/Images/tick_icon32_2.png" KeepOnMouseOver="true">
                                        </telerik:RadNotification>
                                        <telerik:RadNotification RenderMode="Lightweight" ID="ntfError" runat="server" Position="BottomRight"
                                            AutoCloseDelay="6000" Width="350" Height="200" EnableShadow="true" Animation="Fade" Title="Title"
                                            EnableRoundedCorners="true" TitleIcon="none" ContentIcon="delete" KeepOnMouseOver="true">
                                        </telerik:RadNotification>
                                        <asp:HiddenField runat="server" ID="hdnSelectedmanifold" />
                                        <asp:HiddenField runat="server" ID="hdnFormType" Value="NEW" />
                                        <asp:HiddenField runat="server" ID="hdnTrxID" />
                                    </telerik:RadAjaxPanel>
                                </ContentTemplate>
                            </telerik:RadWindow>

1 Answer, 1 is accepted

Sort by
0
Peter Milchev
Telerik team
answered on 08 Feb 2018, 01:41 PM
Hello Mohamed,

Some of the CheckBoxes are with the AutoPostback property set to true, others are without this property set, but the default value for it is true. We tested a stripped version of the provided code snippet using a RadAsyncUpload control, and the files are not lost when the checkboxes with AutoPostBack=false are checked as demonstrated in this screencast: https://www.screencast.com/t/mJO9AJxt

Attached is the sample page we used to record the screencast.

The RadAsyncUpload control allows you to persist uploaded files across postbacks: How to Persist Uploaded Files. The Dynamically change the PostbackTriggers collection of the AsyncUpload article might also be helpful.

Regards,
Peter Milchev
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
CheckBox
Asked by
Mohamed
Top achievements
Rank 1
Answers by
Peter Milchev
Telerik team
Share this question
or