S
SteveS
This problem is driving me nuts... I have a datagrid which a user can "Approve" or "Deny" a record. I created a radiolist control with "Approve" and "Deny". When the user clicks the submit button, I want to check each row to see which button was checked. For some reason, it doesn't see anything that is checked. This is baffling me. I also tried using the HtmlInputRadioButton control, but that didn't work either. Does anyone have any ideas why the code is never selected?
Thank you in advance!
Here is my code:
ASPX PAGE:
<asp:datagrid runat="server" id="pendingChangesGrid" allowsorting="True" allowpaging="True" autogeneratecolumns="False" onsortcommand="SortGrid" >
<columns>
<asp:BoundColumn DataField="NickName" SortExpression="NickName" ReadOnly="True" HeaderText="Nick Name"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:RadioButtonList Runat="server" ID="rdoList" RepeatDirection=Horizontal>
<asp:ListItem>Approve</asp:ListItem>
<asp:ListItem>Deny</asp:ListItem>
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateColumn>
</columns>
</asp:datagrid>
ASPX.VB PAGE:
Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
For Each item As DataGridItem In pendingChangesGrid.Items
Dim rbList As New RadioButtonList
rbList = CType(item.FindControl("rdoList"), RadioButtonList)
'THESE ITEMS NEVER SEEM TO BE SELECTED, EVEN THOUGH I SELECT THEM!
Select Case True
Case rbList.Items(0).Selected
'Approved
'...do stuff...
Case rbList.Items(1).Selected
'Denied
'... do stuff...
End Select
Next
End Sub
Thank you in advance!
Here is my code:
ASPX PAGE:
<asp:datagrid runat="server" id="pendingChangesGrid" allowsorting="True" allowpaging="True" autogeneratecolumns="False" onsortcommand="SortGrid" >
<columns>
<asp:BoundColumn DataField="NickName" SortExpression="NickName" ReadOnly="True" HeaderText="Nick Name"></asp:BoundColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:RadioButtonList Runat="server" ID="rdoList" RepeatDirection=Horizontal>
<asp:ListItem>Approve</asp:ListItem>
<asp:ListItem>Deny</asp:ListItem>
</asp:RadioButtonList>
</ItemTemplate>
</asp:TemplateColumn>
</columns>
</asp:datagrid>
ASPX.VB PAGE:
Private Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
For Each item As DataGridItem In pendingChangesGrid.Items
Dim rbList As New RadioButtonList
rbList = CType(item.FindControl("rdoList"), RadioButtonList)
'THESE ITEMS NEVER SEEM TO BE SELECTED, EVEN THOUGH I SELECT THEM!
Select Case True
Case rbList.Items(0).Selected
'Approved
'...do stuff...
Case rbList.Items(1).Selected
'Denied
'... do stuff...
End Select
Next
End Sub