Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

child control value

Status
Not open for further replies.

need2progm

Programmer
Dec 13, 2002
92
US
In a html table that has radio buttons dynamically added
I am unable to retrieve that controls value.

here is what I have

Control created..
Private Sub listQuest_ItemClicked
For Each xanswer In questAnswers
Dim Row As New System.Web.UI.HtmlControls.HtmlTableRow()
Dim RadioBtnAnswer As New System.Web.UI.WebControls.RadioButton()
Dim cellA As New System.Web.UI.HtmlControls.HtmlTableCell()
Dim cellB As New System.Web.UI.HtmlControls.HtmlTableCell()
With RadioBtnAnswer
.GroupName = "Answers"
.ID = AnsText.AnswerID
.EnableViewState = True
.Enabled = True
End With
cellA.Controls.Add(RadioBtnAnswer)
cellB.ID = AnsText.AnswerID
cellB.InnerHtml = AnsText.AnswerText

Row.Cells.Add(cellA)
Row.Cells.Add(cellB)
tblQandAselect.Rows.Add
Next

That works.... what doesn't work is the when user makes a selection getting that value back out

Dim AnswerBtn As New System.Web.UI.WebControls.RadioButton()
For Each Answer In Answers
For Each Row In tblQandAselect.Rows

'testing
Dim x As Boolean
x = Row.Cells(0).HasControls '*** x = nothing

'testing to find control
AnswerBtn = Row.Cells(0).Controls.Item(0)

'testing to find control
AnswerBtn = Row.Cells(0).FindControl(Answer.AnswerID)

'testing to find control
AnswerBtn = Row.Cells(0).Controls.Item(0)

****This is what I want to do****
If AnswerBtn.Checked Then
'validate

I looked at thread796-494069 a sugestion was to have a sub that loops through the controls to do something would that be useful here?

Thanks for any sugestions



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top