locked
How to enable a particular item in dropdown list an disable other items in Asp.net application RRS feed

  • Question

  • How to enable a particular item in dropdown list an disable other items in Asp.net application

    example

    List<UserControlLibrary.View> chartPanelItems = new List<UserControlLibrary.View>();
                chartPanelItems.Add(new UserControlLibrary.View() { Name = SummaryView, IsSelected = true);
            
    chartPanelItems.Add(new UserControlLibrary.View() { Name = PieChartAndTable });
                chartPanelItems.Add(new UserControlLibrary.View() { Name = BarChartAndTable });
                chartPanelItems.Add(new UserControlLibrary.View() { Name = ColumnChartAndTable });
                chartPanelItems.Add(new UserControlLibrary.View() { Name = PieChartAndGrid });
                chartPanelItems.Add(new UserControlLibrary.View() { Name = BarChartAndGrid });
                chartPanelItems.Add(new UserControlLibrary.View() { Name = ColumnChartAndGrid });
                btnView.ChartPaneItems = chartPanelItems;
          
    I have added 7 radiobuttons inside a panel list box,i wanto enalble only one radiobutton item and disable others,pls help


    Wednesday, June 18, 2014 8:01 AM

All replies

  • If you add items using a loop (without binding) and myControl.Items.Add( new ListItem( . . . . ) ), then you can pass false for disabled items. Perform some experiments and also ask the experts in special forum: http://forums.asp.net.

    Wednesday, June 18, 2014 9:20 AM
  • Thank you, But where we have to pass false,Can you please explain it in  detail.
     Iam not able to pass  IsEnabled=false in the below code   

    chartPanelItems.Add(new UserControlLibrary.View() { Name = SummaryView, IsSelected = true);

    Below one is showing error

    chartPanelItems.Add(new UserControlLibrary.View() { Name = SummaryView,  IsEnabled=false);


    I have added 7 radiobuttons inside a panel list box,i wanto enalble only one radiobutton item and disable others
    • Edited by Deeyaa Wednesday, June 18, 2014 11:35 AM
    Wednesday, June 18, 2014 11:02 AM
  • The constructor of ListItem has a parameter called enable, which allows you to enable or disable the added items. Here are the details and a sample: http://msdn.microsoft.com/en-us/library/ec0w4405(v=vs.110).aspx.

    Wednesday, June 18, 2014 11:17 AM
  • ListItem Item = new ListItem(ListBox1.SelectedItem.Text, ListBox1.SelectedItem.Value, true);
    ListBox2.Items.Add(Item);                                                                                                                                                              

    It will show only the selected item in the list,other items in the list will not be visible. But i want to disable them

    Wednesday, June 18, 2014 11:51 AM
  • Hi Deeyaa,

    In my opinion, this thread is related to ASP.NET forum. So please post thread on that forum for more effective response. Thank you for understanding. Please refer to the following link. http://forums.asp.net/.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Monday, June 23, 2014 8:01 AM