473,398 Members | 2,368 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,398 software developers and data experts.

Change RadioButtonList Attributes

Is there a to change just one radio button in a list just after DataBinding
but before send the page to the user?

For example:

RFPServiceTypes.DataSource = myDbObject.RunProcedure("GetRFPServiceTypes",
parameters)
RFPServiceTypes.DataTextField = "Description"
RFPServiceTypes.DataBind()
RFPServiceTypes.Items.Insert(0, "All Services")

That is my RadioButtonList where I add "All Services" to the top of the
list.

I want to be able to set the attributes OnSelectedIndexChanged and
AutoPostback so that if the user clicks the first radio button, all the
others get selected also.

But I only want to do it for the first button and not all of them.

Can this be done?

Thanks,

Tom
Nov 19 '05 #1
4 2409
My mistake. This is a CheckBoxList. This would make no sense with a
RadioButtonList. How can you do it (if it can be done) with a CheckBoxList?

"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is there a to change just one radio button in a list just after
DataBinding but before send the page to the user?

For example:

RFPServiceTypes.DataSource =
myDbObject.RunProcedure("GetRFPServiceTypes", parameters)
RFPServiceTypes.DataTextField = "Description"
RFPServiceTypes.DataBind()
RFPServiceTypes.Items.Insert(0, "All Services")

That is my RadioButtonList where I add "All Services" to the top of the
list.

I want to be able to set the attributes OnSelectedIndexChanged and
AutoPostback so that if the user clicks the first radio button, all the
others get selected also.

But I only want to do it for the first button and not all of them.

Can this be done?

Thanks,

Tom

Nov 19 '05 #2
Tshad,

In the post back event just use an if then to check if the first checkbox
has been checked. If it has, then check all the others.

If MyCheckBoxList.Items(0).Selected Then
Dim ItemCount, ItemLoop As Int32
ItemCount = MyCheckBoxList.Items.Count - 1

'---Start loop at 1 instead of zero to skip first checkbox
For ItemLoop = 1 To ItemCount
MyCheckBoxList.Items.Item(ItemLoop).Selected = True
Next
End If

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is there a to change just one radio button in a list just after
DataBinding but before send the page to the user?

For example:

RFPServiceTypes.DataSource =
myDbObject.RunProcedure("GetRFPServiceTypes", parameters)
RFPServiceTypes.DataTextField = "Description"
RFPServiceTypes.DataBind()
RFPServiceTypes.Items.Insert(0, "All Services")

That is my RadioButtonList where I add "All Services" to the top of the
list.

I want to be able to set the attributes OnSelectedIndexChanged and
AutoPostback so that if the user clicks the first radio button, all the
others get selected also.

But I only want to do it for the first button and not all of them.

Can this be done?

Thanks,

Tom

Nov 19 '05 #3
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:Oo**************@TK2MSFTNGP09.phx.gbl...
Tshad,

In the post back event just use an if then to check if the first checkbox
has been checked. If it has, then check all the others.
The problem is that I don't want the others to post back. Only the Select
All Checkbox. That was why I wanted to put autopostback only on the first
one. I solved the problem by just creating one Checkbox for Select All and
the rest in the Checkboxlist and then I can put the autopostback only on
that checkbox.

I would still be interested if there is a way to set an attribute to only
one of the checkboxes in a list (in this case the first one, that I add
after I do the databind).

Thanks,

Tom
If MyCheckBoxList.Items(0).Selected Then
Dim ItemCount, ItemLoop As Int32
ItemCount = MyCheckBoxList.Items.Count - 1

'---Start loop at 1 instead of zero to skip first checkbox
For ItemLoop = 1 To ItemCount
MyCheckBoxList.Items.Item(ItemLoop).Selected = True
Next
End If

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is there a to change just one radio button in a list just after
DataBinding but before send the page to the user?

For example:

RFPServiceTypes.DataSource =
myDbObject.RunProcedure("GetRFPServiceTypes", parameters)
RFPServiceTypes.DataTextField = "Description"
RFPServiceTypes.DataBind()
RFPServiceTypes.Items.Insert(0, "All Services")

That is my RadioButtonList where I add "All Services" to the top of the
list.

I want to be able to set the attributes OnSelectedIndexChanged and
AutoPostback so that if the user clicks the first radio button, all the
others get selected also.

But I only want to do it for the first button and not all of them.

Can this be done?

Thanks,

Tom


Nov 19 '05 #4
Tom,

The only way I can think of would be to write a javascript that would fire
when a checkbox is selected. Then an if then in the javascript could check
if it's the first checkbox that's selected. I know you're taking a look at
my checkboxlist required field validator control. The javascript in that
could be converted to do this.

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"tshad" <ts**********@ftsolutions.com> wrote in message
news:OW**************@tk2msftngp13.phx.gbl...
"S. Justin Gengo" <justin@[no_spam_please]aboutfortunate.com> wrote in
message news:Oo**************@TK2MSFTNGP09.phx.gbl...
Tshad,

In the post back event just use an if then to check if the first checkbox
has been checked. If it has, then check all the others.


The problem is that I don't want the others to post back. Only the Select
All Checkbox. That was why I wanted to put autopostback only on the first
one. I solved the problem by just creating one Checkbox for Select All
and the rest in the Checkboxlist and then I can put the autopostback only
on that checkbox.

I would still be interested if there is a way to set an attribute to only
one of the checkboxes in a list (in this case the first one, that I add
after I do the databind).

Thanks,

Tom

If MyCheckBoxList.Items(0).Selected Then
Dim ItemCount, ItemLoop As Int32
ItemCount = MyCheckBoxList.Items.Count - 1

'---Start loop at 1 instead of zero to skip first checkbox
For ItemLoop = 1 To ItemCount
MyCheckBoxList.Items.Item(ItemLoop).Selected = True
Next
End If

--
Sincerely,

S. Justin Gengo, MCP
Web Developer / Programmer

www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
"tshad" <ts**********@ftsolutions.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Is there a to change just one radio button in a list just after
DataBinding but before send the page to the user?

For example:

RFPServiceTypes.DataSource =
myDbObject.RunProcedure("GetRFPServiceTypes", parameters)
RFPServiceTypes.DataTextField = "Description"
RFPServiceTypes.DataBind()
RFPServiceTypes.Items.Insert(0, "All Services")

That is my RadioButtonList where I add "All Services" to the top of the
list.

I want to be able to set the attributes OnSelectedIndexChanged and
AutoPostback so that if the user clicks the first radio button, all the
others get selected also.

But I only want to do it for the first button and not all of them.

Can this be done?

Thanks,

Tom



Nov 19 '05 #5

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

Similar topics

2
by: Mike S | last post by:
I am trying to use a RadioButtonList bound to a custom datasource to acomplish some user functionality. I want to add various onmouseover/onmouseout/onblur/onfocus events to each individual...
2
by: sramruttun | last post by:
hi I have a checkbox and a radiobuttonlist (the radiobuttonlist contains 2 items) in my form. The radiobuttonlist has its visible property set to false at design time. At run time, when the...
4
by: mg | last post by:
How can I change the color of the display text beside a single ListItem of a RadioButtonList when the associated radiobutton is selected - hopefully using C# in the codebehind of a WebForm? ...
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...
5
by: DotNetGruven | last post by:
Anyone have any pointers on how to set the Value and Selected attributes in a ListItem in a RadioButtonList that is in a DataGrid? Here's what I have ------DataGrid------ -- BoundColumn 0 --...
1
by: novice_developer | last post by:
Hi All, there is a radiobuttonlist having 2 list items (state & zipcode). when i select state radiobutton the zipcode textbox should be disabled and when i select a zipcode radiobutton the state...
0
by: djarmoluk | last post by:
I have a RadioButtonList (named rbAnswers) control within a repeater control. When binding to the repeater, I am trying to add an "OnChange" attribute to the individual list item controls (input...
3
by: Brian | last post by:
Using external XML, I'm trying to build a quiz, but I can't seem to specify the DataSource for the RadioButtonList within a Repeater ItemTemplate. I've tried a number of approaches, but I haven't...
1
by: =?Utf-8?B?VGhlRHJpZnRlcg==?= | last post by:
This seems to be one of the great mysteries of ASP.NET as I have seen numerous postings on this with absolutely no answers. SetFocus does not work on the RadioButtonList control. Does anybody...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.