473,513 Members | 2,688 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Is it Possible to assign a dynamic ID to a RadiobuttonList??????

I have a datagrid that is listing a bunch of questions from my DB.. I
am creating a radiobuttonlist for each question to give me a yes or no
answer. I would like to use the "QuestionCode" column from that
database to assign the radiobuttonlist ID. Is this possible??????

Nov 19 '05 #1
2 2089
Hi Brian,

It is absolutely possible.

However, unless you have some special requirement, in most
case it's not necessary. Because even you assign a static
id to any control in the datagrid, you can easily get its
reference in many events such as datagrid_ItemCommand,
datagrid_UpdateCommand, datagrid_EditCommand, and so on,
by e.Item.FindControl("staticID").
Anyway, following code snippet shows how to dynamically
assign id to RadioButtonList in datagrid_ItemCreated event

foreach (Control ctrl in e.Item.Cells
[rblColIndex].Controls )
{
string ctrlName = ctrl.GetType().FullName;
if (ctrlName.Equals
("System.Web.UI.WebControls.RadioButtonList"))
{
ctrl.ID = assignID;
}
}

Elton Wang
el********@hotmail.com

-----Original Message-----
I have a datagrid that is listing a bunch of questions from my DB.. Iam creating a radiobuttonlist for each question to give me a yes or noanswer. I would like to use the "QuestionCode" column from thatdatabase to assign the radiobuttonlist ID. Is this possible??????
.

Nov 19 '05 #2

Elton,

Thanks for the response. Here is my problem. Maybe you can help me come
up with a better solution. I am storing 8 groups of questions in a SQL
db. The QuestionHTML column holds the HTML code that will display the
group of questions and two radio buttons. Based on who logs in, it will
display the appropriate group of questions in a datagrid. my problem
now is that I need to iterate through each question and enter each
question as an individual record in the database. I just don't know how
to do it.. I can't get it to work using radiobuttonlists or just using
plain radio buttons... i'm new to asp.net so i am completely stumped.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 19 '05 #3

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

Similar topics

1
1646
by: Shamin | last post by:
Hi All, I'm refering to the code in this article. http://www.dnzone.com/ShowDetail.asp?NewsId=151 I'm trying to do the same in VB.NET and I'm having problems with procedure ProcessSurveyResults. I was hoping to get some help on fixing it. I would really appreciate.
0
973
by: Hardy Wang | last post by:
Hi, I have RadioButtonList control with bunch of items inside on my web form. <asp:RadioButtonList ID="Radio_450" Runat="server" RepeatDirection="Horizontal" Visible="True" CssClass="Radio"> <asp:ListItem >Item 1</asp:ListItem> </asp:RadioButtonList> The eventually rendered HTML code looks like <table id="Radio_450" class="Radio"...
5
3352
by: Mike Salter | last post by:
I created a page that reads a DB for questions and possible answers (usuallyYes/No). I create a panel for each group of questions, and add a panel for each question to the Group panel. To the Question panel I add a label with the question text, and a radiobuttonlist with the answers. I have an eventhandler I add to each radiobuttonlist,...
4
2077
by: Bass Pro | last post by:
Hi, I am creating textbox, radiobuttonlist and checkboxlist dynamically depending on data from a table. It is a questionnaire. I add the control on a Panel control during the 1st load_page event. Each question is displayed and answered, then result written to a SQL table. Then the next question is read from a table and displayed using the...
2
4719
by: Michael Bohman | last post by:
Hi, i have a small problem with assigning a database value to a RadioButtonList control. On my form i have 3 user admin=1, premium=2 and basic=3, theese values is stored in an access database in a text string. My problem is that when i'm loading my form, it uses a repeater control for each user by the way, I can't find a way to assign either...
4
304
by: rn5a | last post by:
Assume that a ASPX page uses a user control named Address.ascx which has 2 TextBoxes. This ASCX page creates 2 properties named 'Address' & 'City' using the Get & Set statements: <script runat="server"> Public Property Address() As String Get Address = txtAddress.Text End Get Set(ByVal value As String)
3
1566
by: Raj | last post by:
Hi there, I am trying to get this work but I can't figure a solution. I have a table on a web page (.aspx) and creating the table contents dynamically. I have two cells for each row of table. First cell is a label field, and second is a radiobuttonlist. Table looks some thing like Your favorite color? *)Red *)Blue *)Green Age?...
13
10697
by: tommymo | last post by:
Hi everyone I'm new to this site and the world of ASP.Net C# programming. I have been learning controls and integrating them with a SQL database. So far I have been able to move along and understand static controls. However I would like to move on to attempt to create some dynamic controls. So I set out to work with a radiobuttonlist...
2
12421
by: vegtard | last post by:
Hi. I'm trying to make a dynamic radiobuttonlist for my site. I've found the code for it by googling and i get how its done, but i cant see to get my references working. I've added the System.Windows.Forms reference, and "using" at the top of the page. (some more googling told me that that was the appropriate reference) but i'm still getting...
0
7270
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, 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...
0
7397
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, 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. ...
1
7125
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...
0
7543
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 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...
0
5703
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5102
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
4757
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...
0
3239
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
813
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.