How to Enable and Disable Radio Button List Item in Programatically

Posted by Kirubakaranb.Tech under ASP.NET on 12/4/2013 | Points: 10 | Views : 7439 | Status : [Member] | Replies : 3
i have a radio button list
Example:
<asp:RadioButtonList ID="rdobtn" runat="server" RepeatDirection="Horizontal" >
<asp:ListItem Text="Stand Alone" Value="0"></asp:ListItem>
<asp:ListItem Text="Cloud" Value="1"></asp:ListItem>
</asp:RadioButtonList>
having two list item with item value
Based on conditon to enable or disable list item in asp.net using c#

code behind
string="Cloud";
if(string="Cloud")
{
//how to enable first list item
//to enable this item <asp:ListItem Text="Stand Alone" Value="0"></asp:ListItem>
}
else
{
//enable second list item
//to enable this item <asp:ListItem Text="Cloud" Value="1"></asp:ListItem>
</asp:RadioButtonList>
}




Responses

Posted by: Bandi on: 12/4/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
http://asp-net-example.blogspot.in/2009/03/how-to-enable-disable-radiobuttonlist.html

Mark This Response as Answer
--
Chandu
http://www.dotnetfunda.com/images/dnfmvp.gif

Kirubakaranb.Tech, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: vishalneeraj-24503 on: 12/4/2013 [Member] [MVP] Platinum | Points: 25

Up
0
Down
refine you code as

string="Cloud";
if(string.ToUpper()=="Cloud".ToUpper())
{
rdobtn.Items[0].Enabled = true;
}
else
{
rdobtn.Items[1].Enabled = true;
}



Kirubakaranb.Tech, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response