properties of Radio buttons on a page

B

Blasting Cap

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
 
G

Guest

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
 
B

Blasting Cap

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 said:
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 said:
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
 
B

Blasting Cap

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 said:
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 said:
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
 
G

Guest

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 said:
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 said:
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 said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top