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

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

1 Answer 189 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Dhamodharan
Top achievements
Rank 1
Dhamodharan asked on 17 Jun 2011, 07:38 AM
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.

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Jun 2011, 12:39 PM
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.
Tags
ListBox
Asked by
Dhamodharan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or