Problem in Rad Control enable disable

4 posts, 0 answers
  1. Heera
    Heera avatar
    10 posts
    Member since:
    Dec 2011

    Posted 11 Apr 2014 Link to this post

     When combobox selectionindex changed(client side) any control enable /
    disable that is work fine but when clicks on button and go to server
    side then control is previous state not a selection changed state.



    first rad textbox state is enable



    ComboBox----> SelectionChanged ------>  rad textbox disable -----> fine

    Button click event server side ----->   rad textbox state is enable that is wrong 
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 11 Apr 2014 in reply to Heera Link to this post

    Hi Heera,

    This is the expected behavior of the RadControls. After PostBack the changes made from client side will not persist. So one suggestion is that you can make that RadTextBox as disable from server side on the Button Click itself.And another suggestion is that you can ajaxify the control, means partial postBack then RadTextBox state will persist after Button Click also.

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Heera
    Heera avatar
    10 posts
    Member since:
    Dec 2011

    Posted 12 Apr 2014 Link to this post

    Thank you for suggestion. Please give me a sample code
  5. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Apr 2014 in reply to Heera Link to this post

    Hi Heera,

    Please have a look into the sample code snippet.

    ASPX:
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadButton1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadComboBox1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadTextBox ID="RadTextBox1" runat="server">
    </telerik:RadTextBox>
    <telerik:RadComboBox ID="RadComboBox1" runat="server" EmptyMessage="Select" OnClientSelectedIndexChanged="OnClientSelectedIndexChanged">
        <Items>
            <telerik:RadComboBoxItem Text="Item1" />
            <telerik:RadComboBoxItem Text="Item2" />
        </Items>
    </telerik:RadComboBox>
    <telerik:RadButton ID="RadButton1" runat="server" Text="Click">
    </telerik:RadButton>

    JavaScript:
    <script type="text/javascript">
        function OnClientSelectedIndexChanged(sender, args) {
            var textbox = $find("<%=RadTextBox1.ClientID %>");
            textbox.disable();
        }
    </script>

    Thanks,
    Shinu.
Back to Top