473,626 Members | 3,965 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Dynamic RadioButtonList problem

Hi,
Here's the situation:

I create a table on run time(Page_Init)
I add a textbox to the first row
I add a RadioButtonList in that same row

The problem is that when I try to get the values that the user selected
from the RadioButtonList I always end up getting the first item
selected. At first my code had the first item selected by default, so I
thought it was just that, because on post back I recreate the whole
thing on the Page_Init, but then I just commented that line, and I
still get the first item selected.

Here's my code:

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
BindTable()
End Sub

Private Sub BindTable()
Dim tr As TableRow
Dim td As TableCell
Dim txtText As New TextBox
Dim rdoYesNo As New RadioButtonList

tr = New TableRow
td = New TableCell
td.Controls.Add (txtText)

rdoYesNo.Items. Add(New ListItem("No", "0"))
rdoYesNo.Items. Add(New ListItem("Yes", "0"))
'rdoYesNo.Items (0).Selected = True
td.Controls.Add (rdoYesNo)

tr.Cells.Add(td )

Table1.Rows.Add (tr)

End Sub

I would also like to know if I can still have the first option selected
on my first call to the page.

Thanks

Nov 19 '05 #1
0 1272

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

Similar topics

1
1650
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.
2
2099
by: Brian | last post by:
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??????
5
3357
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, which is the same for all. The Group panels are then added to Placeholder1.Controls. I then add...
4
2088
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 load_page event again. The questions display and function perfectly. The user anwers the question...
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
1573
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? *)20 *)30 *)40
0
1698
by: mcheng2 | last post by:
Dynamically added RadioButtonList with AutoPostBack = true. On the first postback, SelectedIndex is not updated. For example: SelectedIndex starts at -1. Click Radio #1, SelectedIndex = -1. Click Radio #2, SelectedIndex = 0. Refresh page, SelectedIndex = 1. I've set the ID of the dynamic RadioButtonList control. Any ideas?
13
10709
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 questionnaire. I have a database and in that DB I have 2 tables one which holds the questions and the other...
2
12426
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 this error message: The type or namespace name `RadioButtonList' could not be found. Are you...
0
8199
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,...
0
8705
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8638
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8365
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,...
0
7196
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6125
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
1
2626
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1811
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1511
bsmnconsultancy
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...

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.