473,413 Members | 1,767 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

disable radio button in RadioButtonList

Is it possible to disable just a certain radio button in
a RadioButtonList control? I've researched this issue for
a while now and haven't come up with anything.

Thanks,
Dave
Nov 18 '05 #1
1 5045
Hi Dave
this is possible by amending the html the browser emits
to represent the option buttons through client-side
javascript.

First, Add some script to your page:
function disableoption(control,option)
{
var formObj = document.forms[0];
for (i=0;i<formObj.length;i++)
{
fldObj = formObj.elements[i];
if (fldObj.type == 'radio')
{
var name = control + '_' + option;
if (fldObj.id == name)
fldObj.disabled = true;
}}}

You can then call this script from the server side,
programmatically entering the name of your control and
the index of the item you wish to disable, eg
Page.RegisterStartupScript("disablescript","<SCRIP T
language='javascript'>disableoption
('RadioButtonList2','1');</SCRIPT>");

alex
-----Original Message-----
Is it possible to disable just a certain radio button in
a RadioButtonList control? I've researched this issue fora while now and haven't come up with anything.

Thanks,
Dave
.

Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Michael Albanese | last post by:
I am developing an application to handle my compay's OSHA reporting requirements. Some of the input criteria are technical and narowly defined, so I was trying to prvide what i call "Context...
1
by: John Criswell | last post by:
I have created a radio button list programmatically. C# SqlConnection conn = new SqlConnection("data source=localhost; integrated security=true; initial catalog=pubs"); SqlCommand cmdAuthors =...
2
by: headware | last post by:
How can I disable a single radio button in a RadioButtonList? I tried doing this: radioList.Items.Attributes.Add("disabled", "true"); radioList.Items.Attributes.Add("disabled", "true"); but it...
3
by: Dot net work | last post by:
Is it possible to have a radiobuttonlist control appear on a webform without any radio buttons checked to begin with? I would really like to make sure that the user specifically chooses a radio...
0
by: Ryan Taylor | last post by:
Hello. I am having another issue. I need to execute some JavaScript whenever a radio button is clicked. I am currently using a RadioButtonList control to generate the radio buttons because of...
3
by: pierre.basson | last post by:
Hi, I have a DataList with an Item Template that contains an image and three radio buttons, which are used to indicate the image's status. How can I set the appropriate radio button to checked,...
4
by: enahar | last post by:
I have created RadioButtonList1 having 2 radio buttons in the list.How to make enable/disable only 1 radio button in the RadioButtonlist. Thanks for your help. Regards.
1
by: sama via DotNetMonster.com | last post by:
Hi , I am using a radioButtonList insisde a div. Now, on clcick of a button i want to disable the radiobuttonList. When i say document.getElementById('divsama').disabled=true; it works in IE but...
0
by: dancer | last post by:
Can somebody tell me why my RequiredFieldValidator works for the TEXT BOX, (location) but does NOT work for the RADIO BUTTON (EmpTrain)? <%@ Page Language="VB" ClientTarget="downlevel" %> ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.