This
gridview visualize a checkbox with 2 option on alternate row, the data source of this tow is an IList<GenericGVItem> GenericGVItem is a serializable bean with get and set property.
So i check some row value, and i've a button, in the action of this butto i want retrive the checked value in the list (the list is set in ViewState)
gandalilbian...
Member
5 Points
3 Posts
Get value from radiobutton in gridview after postback
Apr 12, 2012 10:39 AM|LINK
Hi to everyone,
i've this gridview:
<asp:GridView ID="dgMatchingGoalFo" runat="server" AllowPaging="True" AutoGenerateColumns="false"
onpageindexchanging="dgMatchingGoalFo_PageIndexChanging" ViewStateMode="Enabled">
<Columns>
<asp:BoundField DataField="Field1" HeaderText="Pos" ControlStyle-Width="30" HeaderStyle-Width="50"/>
<asp:BoundField DataField="Field2" HeaderText="Tipo" HeaderStyle-Width="60"/>
<asp:BoundField DataField="Field3" HeaderText="CodFili" HeaderStyle-Width="60"/>
<asp:BoundField DataField="Field4" HeaderText="CodAncl" HeaderStyle-Width="100"/>
<asp:BoundField DataField="Field6" HeaderText="Stato" HeaderStyle-Width="20"/>
<asp:TemplateField>
<ItemTemplate>
<asp:Label ID="lblSi" runat="server" Visible='<%# Bind("VisbleField") %>'>
<asp:RadioButtonList id="checkboxlist1" CellPadding="5" CellSpacing="5"
RepeatLayout="Table" TextAlign="Right" runat="server" DataValueField="Field7" autoPostBack="true">
<asp:ListItem Value="true" >Si</asp:ListItem>
<asp:ListItem Value="false">No</asp:ListItem>
</asp:RadioButtonList>
</asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
This gridview visualize a checkbox with 2 option on alternate row, the data source of this tow is an IList<GenericGVItem> GenericGVItem is a serializable bean with get and set property.
So i check some row value, and i've a button, in the action of this butto i want retrive the checked value in the list (the list is set in ViewState)
but i don't see this value on Field7 field.
Can someone help me.
Thanks a lot,
Fabio.
mm10
Contributor
6409 Points
1184 Posts
Re: Get value from radiobutton in gridview after postback
Apr 12, 2012 12:18 PM|LINK
Is your button located inside the GridView? For which row in the GridView do you wish to get the value of the RadioButtonList?
This will get the selectedvalue of the RadioButtonList for the first row in the GridView....:
protected void submit(object sender, EventArgs e) { RadioButtonList rbl = gv.Rows[0].FindControl("checkboxlist1") as RadioButtonList; string value=rbl.SelectedValue; }