iam_clint 1,208
Recognized Expert Top Contributor
Alright I have a page that I have multiple radio buttons being drawn to the page reading from the database. Example
Permissions
Google - ( ) on (x ) off
Nvidia - ( ) on (x ) off
Newegg- ( x) on ( ) off
Google, Nvidia, and Newegg are in a table and it also includes a site id such as
site_id, site_name
1, newegg
2, google
3, nvidia
Another table with user permissions in it
user_id, site_access
1, 1
1, 2
1, 3
2, 2
3, 1
4, 2
I am currently attempting this with a repeater, It writes the radio buttons to the page beautifully. -
<asp:Repeater runat="server" ID="sites">
-
<HeaderTemplate></HeaderTemplate>
-
<ItemTemplate>
-
<tr>
-
<td style="width: 190px; height: 21;" class="member_textlabel"><%#Container.DataItem("site_name")%></td>
-
-
<td style="height: 21px;">
-
<table cellpadding="0" cellspacing="0" style="width: 170">
-
<tr>
-
<td style="width: 24px">
-
<asp:RadioButton runat="server" GroupName="site_access" ID="site_on" /></td>
-
<td class="member_textlabel" style="width: 41px"><%#Container.DataItem("site_id")%>
-
On</td>
-
<td style="width: 20px">
-
<asp:RadioButton runat="server" GroupName="site_access" ID="site_off" /></td>
-
<td class="member_textlabel">
-
Off</td>
-
</tr>
-
</table>
-
</td>
-
</tr>
-
</ItemTemplate>
-
But i cannot figure out how to read these radio buttons server side.
so first thing it needs to put checkboxes in the proper places and next it needs to be able to be modified such as changing the radio button configuration and hitting a save button. So i need to do this in a way i can know what site_id's are on and off server side.
7 2734 Frinavale 9,735
Recognized Expert Moderator Expert
Are you doing this as an exercise to learn how to use repeaters?
There is an easier way to do this ...
Anyways, you need to use the FindControl method to retrieve the RadioButton from the repeater and then check it's value.
C#: -
RadioButton rdo = (RadioButton)myRepeater.FindControl("rdoID");
VB.NET -
Dim rdo As RadioButton = DirectCast(myRepeater.FindControl("rdoID"), RadioButton)
-Frinny
iam_clint 1,208
Recognized Expert Top Contributor
no by all means if there is a different better way to accomplish this let me know.. I am fairly new to asp.net and .net in general.
On a side note I'm not sure how to give each radio button a unique id then be able to grab it in the code because this is all database driven. Is there a way to grab an array of the radio buttons?
Frinavale 9,735
Recognized Expert Moderator Expert
When you talk about grabbing an array of RadioButtons, are you talking about client side or server side.
A RadioButtonList is basically an array of RadioButtons. It's better to use RadioButtonList s in your solution instead of individual radio buttons....main ly because it's hard to set unique IDs for individual radio buttons.
I think using CheckBoxes instead of RadioButtons is probably going to be easier for you in the long run...because then all you have to do is check whether or not the CheckBox has been selected, rather than checking which RadioButton is selected.
Are you not using a GridView because of the overhead costs?
iam_clint 1,208
Recognized Expert Top Contributor
i'm not using gridview because i've been using .net for about 3 weeks.
Yes this page wasn't my design but if I absolutely have to I can change it to checkboxes can you give me a small working example please, content is dynamic.
Frinavale 9,735
Recognized Expert Moderator Expert @iam_clint
Give me a bit and let me see if I can't get something running :)
Are you displaying the site permissions for a single user or for all users at a time?
<edit> oh and what .NET framework are you using?</edit>
iam_clint 1,208
Recognized Expert Top Contributor
.net version is 3.5
its single user at a time.. the dynamic things are just the sites and their id's
Thanks for the help i've been messing around with it to no avail
Frinavale 9,735
Recognized Expert Moderator Expert
I'm sorry but I got pulled into a meeting for most of the day and wasn't able to look into this.
I've got an idea for a solution though :)
Using an ItemTemplate and GridView.
I'll give it a whorl tonight
-Frinny
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Jeff |
last post by:
I'm trying to create a dynamic form that can have multiple groups of
radio buttons (each group has two buttons) with the same name.
Essentially, the form allows a user to enter as many names as they
want. If they need to add more, they click an "add name" button and
the javascript inserts another row of input boxes. Each row should
have two radio buttons to indicate sex (M F).
When you have multiple text input boxes with the same...
|
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>
<input type="radio" name=p2 value=2>
<input type="radio" name=p2 value=3>
then a text area and a button:
|
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
The problem i am facing is that i do not know how many yes/no radio groups
will be generated
|
by: Jay |
last post by:
Good afternoon,
I have a radio list box called rblNavigateOptions and I need to be able to
simply set one of those radio items to disabled before any item is selected
by a user.
ie.
When the rblNavigateOptions control is created one or some of the items it
contains are disabled.
|
by: James P. |
last post by:
Help,
I need to display radio buttons on a form. The data is from SQL
table: each row in each table is displayed as a radio button. I have
multiple SQL tables so I understand I need to put them each in a
GroupBox. All the examples I saw from the books or from the web show
me how to add static radio buttons at design, or dynamically at run
time but with fixed radio buttons (like from an array).
I need to create radio buttons based...
| |
by: kenny8787 |
last post by:
Hi, can anyone help here?
I have the following code generated from a database, I want to have javascript calculate the
costs of the selected items using radio buttons, subtotal the costs and grandtotal the costs
ready for the selected items to be inserted back to the database. I did something like this
before with Checkboxes, but Radio button have to be named the same to maintain their
groupings.
|
by: Robert J. Bonn |
last post by:
I am setting up a contact list for a musician, who is about to release
her first CD.
She would like a contact list that can track all the people she meets,
who will be in various categories -- fans, radio station personnel,
owners of clubs, other musicians, etc.
Ideally, I'd like to create a form that asks basic questions for
everyone (name, phone number, etc.) No problem. But then, there
will be different kinds of information,...
|
by: dpazza |
last post by:
Hi,
I'm creating a quiz on using a form in VB 2005 express.
I have four sets of questions and answers (labels and radio buttons)
and I change between which set of questions is currently shown on the
form by changing the visible state of the radio buttons and labels
utilising back and next buttons.
E.g. Next button makes current radio buttons and labels invisible and
|
by: CURTISLESPERANCE |
last post by:
Hi, I am trying to figure out if this is possible. I need to display 4 radio buttons next to a question then 3 radio buttons after. The 2 different group radio buttons and questions are coming from a database.
I have the questions being displayed right now using a repeater control but I am having an issue making 4 and 3 radio buttins per question for multiple questions. However some questions have sub questions so the parent question...
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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 then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |