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. 10 6656
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.
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" <ke**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
>
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.
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" <ke**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
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.
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" <ke**********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
>
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" <ke**********@gmail.comwrote in message news:11**********************@h48g2000cwc.googleg roups.com...
>
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.
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" <ke**********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
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" <ke**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
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.
Kevin,
The problem with having the runat="server" in the html radio button, is that
even though it keeps the selected item, when I select other item(s),
the other selections remain., and can not be un-selected.
here is the itemtemplate:
<ItemTemplate>
<input name="rbMonday" type="radio" enableviewstate="true" value='<%#
Eval("song") %>' />
</ItemTemplate>
Thanks again
Carlos
"kferron" <ke**********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
>
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" <ke**********@gmail.comwrote in message news:11**********************@h48g2000cwc.googleg roups.com...
>
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.
well, thats an html issue.. if you want the radio buttons to behave
correctly you will need to name them all the same thing
Carlos wrote:
Kevin,
The problem with having the runat="server" in the html radio button, is that
even though it keeps the selected item, when I select other item(s),
the other selections remain., and can not be un-selected.
here is the itemtemplate:
<ItemTemplate>
<input name="rbMonday" type="radio" enableviewstate="true" value='<%#
Eval("song") %>' />
</ItemTemplate>
Thanks again
Carlos
"kferron" <ke**********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
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" <ke**********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
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.
kferron is right...
Furthermore you can find a number of articles on CodeProject on how to group
radio buttons on asp.net.
HTH
____________________
Konstantinos Pantos
MCP Software Engineer
"Carlos" <ch******@yahoo.comwrote in message
news:uE*************@TK2MSFTNGP04.phx.gbl...
>
Kevin,
The problem with having the runat="server" in the html radio button, is
that
even though it keeps the selected item, when I select other item(s),
the other selections remain., and can not be un-selected.
here is the itemtemplate:
<ItemTemplate>
<input name="rbMonday" type="radio" enableviewstate="true" value='<%#
Eval("song") %>' />
</ItemTemplate>
Thanks again
Carlos
"kferron" <ke**********@gmail.comwrote in message
news:11*********************@i42g2000cwa.googlegro ups.com...
>> 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" <ke**********@gmail.comwrote in message news:11**********************@h48g2000cwc.google groups.com...
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.
I thank you all for your kind response. However, I believe that
it does not address the issue. I am using html radiobuttons because
I read somewhere that it was better because you just need to get
their values issuing a request.form with the name of the control
within a template. However, after a postback if a user needs to see
what it had selected there is no way for the selection to remain.
My question is if there is an efficient sample somewhere that I can look at.
Thanks,
Carlos.
"Konstantinos Pantos" <ko***********@hotmail.comwrote in message
news:CE**********************************@microsof t.com...
kferron is right...
Furthermore you can find a number of articles on CodeProject on how to
group radio buttons on asp.net.
HTH
____________________
Konstantinos Pantos
MCP Software Engineer
"Carlos" <ch******@yahoo.comwrote in message
news:uE*************@TK2MSFTNGP04.phx.gbl...
>> Kevin,
The problem with having the runat="server" in the html radio button, is that even though it keeps the selected item, when I select other item(s), the other selections remain., and can not be un-selected.
here is the itemtemplate:
<ItemTemplate>
<input name="rbMonday" type="radio" enableviewstate="true" value='<%# Eval("song") %>' />
</ItemTemplate>
Thanks again
Carlos
"kferron" <ke**********@gmail.comwrote in message news:11*********************@i42g2000cwa.googlegr oups.com...
>>> 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("rbMonda y"));
if (rb.Checked == true)
{
Response.Write("found it..");
// Column 2 is the name column
}
} Thanks, Carlos.
"kferron" <ke**********@gmail.comwrote in message news:11**********************@h48g2000cwc.googl egroups.com...
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.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Flinky Wisty Pomm |
last post by:
Hi all, I've got a really annoying problem that I need to fix sharpish.
I've got a GridView derived control which has a templated header and
footer. It works wonderfully on the first render but...
|
by: tarscher |
last post by:
Hi all,
I have a gridview populated with data coming from a dataset (created
via the wizard). The data shown in the gridview is dependent on the the
choice of a control (dropdown with...
|
by: mercercreek |
last post by:
This one should be easy. Hope someone has a clue.
Simple Scenario: Gridview with mulitple rows, each row with a checkbox.
The user checks boxes of her choice. Clicks a button on the form (not
in...
|
by: Gonza |
last post by:
Hi group, i have a question relatred to gridview and postback (i should
probably know this by now, considering i've been working with .net for
a few years now, but baahh). Why could a gridview...
|
by: =?Utf-8?B?dmFuZGls?= |
last post by:
I have a web app that I have been working on for the last couple of weeks
trying to solve this problem. One page contains a GridView with four base
columns, and an unknown number of columns to be...
|
by: Cindy Lee |
last post by:
When I do a sorta on 1 table, then the other table goes back to the original
order.
What can I set so, it keeps the order of the other current gridview's order.
I set all the gridview values...
|
by: =?Utf-8?B?V0I=?= |
last post by:
Hi,
I have a .NET page which has a gridview of customers from Northwind
database. There's a checkbox for each customer and the gridview allows
paging.
I would like to be able to persist the...
|
by: Eraser |
last post by:
Hi to all .NET guru guys...
I have a problem in my delete button inside gridview. How to avoid postback on when i select cancel on confirmation message? But postback is okay on Ok confirmation....
|
by: =?Utf-8?B?cm9kY2hhcg==?= |
last post by:
hey all,
i'm in a gridview edit row that has a DropDownList in one column and a
status Label in the 2nd column.
When i changed the value in the dropdownlist, there's a client-side
javascirpt...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |