473,396 Members | 1,866 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,396 software developers and data experts.

properties of Radio buttons on a page


I have a page that has a number of radio buttons that will be displayed
to different access levels of a user who logs in to my website.

For instance, if there are a dozen buttons, user1 will see all twelve.
User2 would see buttons 1-3,10-12 and NOT any others, and so on.

Since there are several buttons on the page (each one would run a report
for them), is there a way to - in an onclick event for each of the
buttons - to programatically go thru and bold the font of the
description of the button, and un-bold the rest of them? Doing this in
order to make it more apparent as to which report they've just run.

I know that I could do a bunch of if statements to do this, but would
prefer to do it in a loop.

The radio buttons are independent of each other, as this code is being
inserted into a page that already had a few of them on it previously
(the newer buttons are the newer reports).

Anyone know how to do this, or perhaps have a better way to do it?

Appreciate any suggestions or advice.

Thanks,

BC
May 23 '07 #1
4 2495
You have two totally independent questions here, and a confusing statement:
1) how to display only relevant content (radio buttons) depending on the user
2) how to enbold one control of the list on postback
3) list of radio buttons that are independent - why use radio buttons?

One way to acconplish the first two would be:
1)
- create a bitmask based on user Role, say 1 - public, 2 - power user, 4 -
admin
- associate eash radio button with relevant value, say btn1 - 7, btn2 - 6,
btn3 - 4
- loop through your list of buttons and only display those that match
current user, for example:
int userRoleMask = 3; // (power user + public)
foreach (object btn in myBtnList) // any structure for myBtn will do, just
ensure it implements RoleMask property, and the actual RadioButton
{
btn.RadioButton.Visible = btn.RoleMask & userRoleMask; // in VB your would
use And instead of &
}

2) I would create a private property on the page to store the last bold
label, and then on postback check if new one needs to be bold then unbold the
old one and store the newly bold one instead. Something like:
private string boldID
{
get{return this.ViewState["BoldID"] as string;}
set{this.ViewState["BoldID"] = value;}
}

HTH

"Blasting Cap" wrote:
>
I have a page that has a number of radio buttons that will be displayed
to different access levels of a user who logs in to my website.

For instance, if there are a dozen buttons, user1 will see all twelve.
User2 would see buttons 1-3,10-12 and NOT any others, and so on.

Since there are several buttons on the page (each one would run a report
for them), is there a way to - in an onclick event for each of the
buttons - to programatically go thru and bold the font of the
description of the button, and un-bold the rest of them? Doing this in
order to make it more apparent as to which report they've just run.

I know that I could do a bunch of if statements to do this, but would
prefer to do it in a loop.

The radio buttons are independent of each other, as this code is being
inserted into a page that already had a few of them on it previously
(the newer buttons are the newer reports).

Anyone know how to do this, or perhaps have a better way to do it?

Appreciate any suggestions or advice.

Thanks,

BC
May 23 '07 #2
Sergey - Thank you for the help. I'll try them later on today.

As to your third question - why use radio buttons - because that's what
was originally done on the page, and since I've been maintaining the
application, it has been more development-time efficient to simply "add
a new radio button" than it has been to re-do that part of the page. Is
there a better way to do what I'm wanting to do than by using radio buttons?

BC
Sergey Poberezovskiy wrote:
You have two totally independent questions here, and a confusing statement:
1) how to display only relevant content (radio buttons) depending on the user
2) how to enbold one control of the list on postback
3) list of radio buttons that are independent - why use radio buttons?

One way to acconplish the first two would be:
1)
- create a bitmask based on user Role, say 1 - public, 2 - power user, 4 -
admin
- associate eash radio button with relevant value, say btn1 - 7, btn2 - 6,
btn3 - 4
- loop through your list of buttons and only display those that match
current user, for example:
int userRoleMask = 3; // (power user + public)
foreach (object btn in myBtnList) // any structure for myBtn will do, just
ensure it implements RoleMask property, and the actual RadioButton
{
btn.RadioButton.Visible = btn.RoleMask & userRoleMask; // in VB your would
use And instead of &
}

2) I would create a private property on the page to store the last bold
label, and then on postback check if new one needs to be bold then unbold the
old one and store the newly bold one instead. Something like:
private string boldID
{
get{return this.ViewState["BoldID"] as string;}
set{this.ViewState["BoldID"] = value;}
}

HTH

"Blasting Cap" wrote:
>I have a page that has a number of radio buttons that will be displayed
to different access levels of a user who logs in to my website.

For instance, if there are a dozen buttons, user1 will see all twelve.
User2 would see buttons 1-3,10-12 and NOT any others, and so on.

Since there are several buttons on the page (each one would run a report
for them), is there a way to - in an onclick event for each of the
buttons - to programatically go thru and bold the font of the
description of the button, and un-bold the rest of them? Doing this in
order to make it more apparent as to which report they've just run.

I know that I could do a bunch of if statements to do this, but would
prefer to do it in a loop.

The radio buttons are independent of each other, as this code is being
inserted into a page that already had a few of them on it previously
(the newer buttons are the newer reports).

Anyone know how to do this, or perhaps have a better way to do it?

Appreciate any suggestions or advice.

Thanks,

BC
May 24 '07 #3
Before you answer the question (about is there a better way to do what
I'm doing...) - some info:

This is a web application, dotnet framework 2.0, VS 2005.

When I come in to the page, I have a username and a "level" assigned to
the user thru a session variable or a cookie. There are 8 levels, each
of them show a different combination of the same reports. This level
gets passed in to a sql query that determines what type of data is
returned in those queries.

For instance - a user at level 6 would see reports 1,2,3,7,9,12

User at level 5 would see reports 2,4,7,9,11,12

User at level 3 would see reports 5 & 6

Ideally, I'd like for the selection list of the reports to have a
similar "look" for each user - meaning that if he saw 12 reports, they'd
be 12 contiguous ones, if he saw 6 of them, they'd look like they were
the list he would see (i.e. no "gaps" between the reports for the ones
omitted for the user who saw 6 reports versus 12.

Thanks,

BC

Sergey Poberezovskiy wrote:
You have two totally independent questions here, and a confusing statement:
1) how to display only relevant content (radio buttons) depending on the user
2) how to enbold one control of the list on postback
3) list of radio buttons that are independent - why use radio buttons?

One way to acconplish the first two would be:
1)
- create a bitmask based on user Role, say 1 - public, 2 - power user, 4 -
admin
- associate eash radio button with relevant value, say btn1 - 7, btn2 - 6,
btn3 - 4
- loop through your list of buttons and only display those that match
current user, for example:
int userRoleMask = 3; // (power user + public)
foreach (object btn in myBtnList) // any structure for myBtn will do, just
ensure it implements RoleMask property, and the actual RadioButton
{
btn.RadioButton.Visible = btn.RoleMask & userRoleMask; // in VB your would
use And instead of &
}

2) I would create a private property on the page to store the last bold
label, and then on postback check if new one needs to be bold then unbold the
old one and store the newly bold one instead. Something like:
private string boldID
{
get{return this.ViewState["BoldID"] as string;}
set{this.ViewState["BoldID"] = value;}
}

HTH

"Blasting Cap" wrote:
>I have a page that has a number of radio buttons that will be displayed
to different access levels of a user who logs in to my website.

For instance, if there are a dozen buttons, user1 will see all twelve.
User2 would see buttons 1-3,10-12 and NOT any others, and so on.

Since there are several buttons on the page (each one would run a report
for them), is there a way to - in an onclick event for each of the
buttons - to programatically go thru and bold the font of the
description of the button, and un-bold the rest of them? Doing this in
order to make it more apparent as to which report they've just run.

I know that I could do a bunch of if statements to do this, but would
prefer to do it in a loop.

The radio buttons are independent of each other, as this code is being
inserted into a page that already had a few of them on it previously
(the newer buttons are the newer reports).

Anyone know how to do this, or perhaps have a better way to do it?

Appreciate any suggestions or advice.

Thanks,

BC
May 24 '07 #4
If you drive your report list from the database, you could use Repeater and
place your option button inside ItemTemplate (do not forget to set GroupName
for your RadioButton) - this way you will always have them running
continuously.
"Blasting Cap" wrote:
Before you answer the question (about is there a better way to do what
I'm doing...) - some info:

This is a web application, dotnet framework 2.0, VS 2005.

When I come in to the page, I have a username and a "level" assigned to
the user thru a session variable or a cookie. There are 8 levels, each
of them show a different combination of the same reports. This level
gets passed in to a sql query that determines what type of data is
returned in those queries.

For instance - a user at level 6 would see reports 1,2,3,7,9,12

User at level 5 would see reports 2,4,7,9,11,12

User at level 3 would see reports 5 & 6

Ideally, I'd like for the selection list of the reports to have a
similar "look" for each user - meaning that if he saw 12 reports, they'd
be 12 contiguous ones, if he saw 6 of them, they'd look like they were
the list he would see (i.e. no "gaps" between the reports for the ones
omitted for the user who saw 6 reports versus 12.

Thanks,

BC

Sergey Poberezovskiy wrote:
You have two totally independent questions here, and a confusing statement:
1) how to display only relevant content (radio buttons) depending on the user
2) how to enbold one control of the list on postback
3) list of radio buttons that are independent - why use radio buttons?

One way to acconplish the first two would be:
1)
- create a bitmask based on user Role, say 1 - public, 2 - power user, 4 -
admin
- associate eash radio button with relevant value, say btn1 - 7, btn2 - 6,
btn3 - 4
- loop through your list of buttons and only display those that match
current user, for example:
int userRoleMask = 3; // (power user + public)
foreach (object btn in myBtnList) // any structure for myBtn will do, just
ensure it implements RoleMask property, and the actual RadioButton
{
btn.RadioButton.Visible = btn.RoleMask & userRoleMask; // in VB your would
use And instead of &
}

2) I would create a private property on the page to store the last bold
label, and then on postback check if new one needs to be bold then unbold the
old one and store the newly bold one instead. Something like:
private string boldID
{
get{return this.ViewState["BoldID"] as string;}
set{this.ViewState["BoldID"] = value;}
}

HTH

"Blasting Cap" wrote:
I have a page that has a number of radio buttons that will be displayed
to different access levels of a user who logs in to my website.

For instance, if there are a dozen buttons, user1 will see all twelve.
User2 would see buttons 1-3,10-12 and NOT any others, and so on.

Since there are several buttons on the page (each one would run a report
for them), is there a way to - in an onclick event for each of the
buttons - to programatically go thru and bold the font of the
description of the button, and un-bold the rest of them? Doing this in
order to make it more apparent as to which report they've just run.

I know that I could do a bunch of if statements to do this, but would
prefer to do it in a loop.

The radio buttons are independent of each other, as this code is being
inserted into a page that already had a few of them on it previously
(the newer buttons are the newer reports).

Anyone know how to do this, or perhaps have a better way to do it?

Appreciate any suggestions or advice.

Thanks,

BC
May 24 '07 #5

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

Similar topics

4
by: Oscar Monteiro | last post by:
I Have to sets of Radio buttons like so: <input type="radio" name=p1 value=1> <input type="radio" name=p1 value=2> <input type="radio" name=p1 value=3> <br> <input type="radio" name=p2 value=1>...
6
by: Craig Keightley | last post by:
I have a page that has n number of radio groups (yes/No) how can i prevent the form being submitted if more than one radio group is not selected? By default all radio groups are unchecked ...
5
by: Digital Puer | last post by:
I have the following HTML form: - radio button A (default selected) - radio button B - input field, of type "file" with "Choose" button - submit button I would like to have it so that if the...
7
by: michael | last post by:
apologies in advance, as not only am i new to learning how to code javascript properly, i'm new to the groups posting thing... i am developing in firefox 1.0+, but will be working in an msie 6.0+...
3
by: Ferret Face | last post by:
Hello, I have a web page that gets the user to select items from a list of options. This list is a set of independant Radio Buttons. I did not use a Radio Button List because I wanted the...
1
by: Jerry | last post by:
We have a 10-question quiz for kids, each question being a yes or no answer using radio selections. I'd like to keep a current total of yes's and no's at the bottom of the quiz (if the user selects...
10
by: IchBin | last post by:
I am trying to set the state of a radio button. I do not see what I am doing wrong. Sorry, I am new at this.. I need another set of eyes to look at this snip of code. I am trying to set the radio...
11
by: Twayne | last post by:
Hi, Newbie to PHP here, no C or other relevant background, so pretty niave w/r to the nuances etc. but I think this is pretty basic. XP Pro, SP2+, PHP 4.4.7, XAMPP Local Apache Server...
7
by: gengyue | last post by:
Hi, I am running a report using Cold Fusion. This report is generated by cfloop tag. Depends on the record count of a query, the report will list the data retrieved from the database. each row in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...

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.