how enable radlistbox item in client side which is disabled in server side

2 posts, 0 answers
  1. Dhamodharan
    Dhamodharan avatar
    300 posts
    Member since:
    Sep 2010

    Posted 17 Jun 2011 Link to this post

    Hi,

    I am using radlistbox item disable in server side. but i want enable client side while some value changed. but i am getting enable client side but the text has been shared(like disabled time). how to solve this problem,

    Please let me know,


     Thanks,
    Dhamu.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 17 Jun 2011 Link to this post

    Hello Dhamu,

    In order to preserve the changes after postback you need to call trackChanges and commitChanges.
    Aspx:
    <telerik:RadListBox ID="RadListBox2" CssClass="Large" runat="server" EnableDragAndDrop="true"
                AllowTransfer="true" ButtonSettings-ShowDelete="true">
     <Items>
          <telerik:RadListBoxItem Text="Argentina" />
          <telerik:RadListBoxItem Text="Australia" />
          <telerik:RadListBoxItem Text="Brazil" Selected="true" />
          <telerik:RadListBoxItem Text="Canada" />
          <telerik:RadListBoxItem Text="Chile" />
          <telerik:RadListBoxItem Text="China" />
    </Items>
    </telerik:RadListBox>
    <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
    <asp:Button ID="Button2" runat="server" Text="Disable form client side" OnClientClick="disable();" />

    C#:
    protected void Button1_Click(object sender, EventArgs e)
        {
         RadListBoxItem item=RadListBox2.FindItemByText("Canada");
         item.Enabled = false;
        }

    Javascript:
    function disable()
      {
           var listBox = $find('<%= RadListBox2.ClientID%>');
           listBox.trackChanges();
           listBox.findItemByValue("Canada").set_enabled(true);
           listBox.commitChanges();
       }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top