Re: posting radiobuttons inside a gridview do not persist selection after postback..
- From: "kferron" <kevin.ferron@xxxxxxxxx>
- Date: 15 Nov 2006 13:48:51 -0800
just quickly perusing your html for the radio button, try making sure
there is an id.
<input id="rbMonday" name="rbMonday" type="radio"
enableviewstate="true" runat="server"> value='<%# Eval("payment") %>'
/>
Carlos wrote:
Kevin, thanks again for the continued support.
Here is my gridview html.
<asp:GridView ID="GridView2" runat="server" style="left: 7px; position:
static; top: 116px" AutoGenerateColumns="False" CellPadding="3"
GridLines="None" Width="230px" BackColor="White" BorderColor="#DEDFDE"
BorderWidth="0px" CellSpacing="1" >
<FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
<Columns>
<asp:TemplateField HeaderText="(Select One">
<ItemTemplate>
<input name="rbMonday" type="radio" enableviewstate="true" runat="server"
value='<%# Eval("payment") %>' />
</ItemTemplate>
<HeaderStyle Font-Bold="True" Font-Names="Arial Unicode MS"
Font-Size="X-Small" BackColor="Black" HorizontalAlign="Left"
VerticalAlign="Middle" Width="40px" Wrap="False" />
<ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" Wrap="True" />
</asp:TemplateField>
<asp:BoundField DataField="payment" HeaderText="Payment" >
<ItemStyle Font-Bold="True" Font-Names="Arial Unicode MS"
Font-Size="XX-Small" HorizontalAlign="Left" VerticalAlign="Middle"
Wrap="True" />
<HeaderStyle Font-Bold="True" Font-Names="Arial Unicode MS"
Font-Size="X-Small" BackColor="Black" ForeColor="White"
HorizontalAlign="Center" VerticalAlign="Middle" Wrap="False" />
</asp:BoundField>
</Columns>
<RowStyle BackColor="#DEDFDE" ForeColor="Black" />
<SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Right" />
<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
</asp:GridView>
Thanks again,
Carlos.
"kferron" <kevin.ferron@xxxxxxxxx> wrote in message
news:1163610923.308853.33400@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Do you have runat="server" in the html radio button?
Perhaps you could paste the templatefield html.
Carlos wrote:
Thanks, for the reply. However, I already have the enableviewstate set to
true,
and the problem is that in this snippet, the control variable comes null.
i.e. apparently it can not find the control:
for (int i = 0; i < GridView2.Rows.Count; i++)
{
GridViewRow row = GridView11.Rows[i];
HtmlInputRadioButton rb =
(HtmlInputRadioButton)(row.FindControl("rbMonday"));
if (rb.Checked == true)
{
Response.Write("found it..");
// Column 2 is the name column
}
}
Thanks,
Carlos.
"kferron" <kevin.ferron@xxxxxxxxx> wrote in message
news:1163578823.892887.122110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
enable viewstate on the radiobutton control in the template field?
Carlos wrote:
Hi all,
I have a form with an input radio control in a template field.
When the user selects an option, and press a button
the selection disappears.. I would like the selection to
persist after the button makes the postback,
I tried using the findcontrol but it returns null, and do not know how
to make sure that the radio selected persist after the button
action makes the postback.
Thanks in advance,
Carlos.
.
- References:
- posting radiobuttons inside a gridview do not persist selection after postback..
- From: Carlos
- Re: posting radiobuttons inside a gridview do not persist selection after postback..
- From: kferron
- Re: posting radiobuttons inside a gridview do not persist selection after postback..
- From: Carlos
- Re: posting radiobuttons inside a gridview do not persist selection after postback..
- From: kferron
- Re: posting radiobuttons inside a gridview do not persist selection after postback..
- From: Carlos
- posting radiobuttons inside a gridview do not persist selection after postback..
- Prev by Date: Re: looking for a very basic XML read example
- Next by Date: Running trough a Table of a DataSet
- Previous by thread: Re: posting radiobuttons inside a gridview do not persist selection after postback..
- Next by thread: Re: posting radiobuttons inside a gridview do not persist selection after postback..
- Index(es):