need2progm
Programmer
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
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