access Radio button button in repeater control..........how?

I am displaying some records using repeater control. Each row will have a radio button. User will select one of the records and will click the submit button. Now I have some questions,
1) For radio button should I use html radio button (input type=radio) OR use web server control Radio button?
2) How can I access the checked radio button in either case above?

thanks in advance.
feed the creative machine
0
mp417
9/6/2005 7:08:02 AM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies
2024 Views

Similar Articles

[PageSpeed] 49

1. You can use either, as long as they both have runat="server". The server control gives you a more consistent programming model.

2. Since the radio button will be in a template you need to use FindControl:

Dim rb As RadioButton = DirectCast(Repeater1.FindControl("MyRadioButton"), RadioButton)

Dave
0
Dave
9/6/2005 8:24:53 AM

dave,
thanks for ur reply.
I am using asp:RadioButton control. here is the code,

<asp:RadioButton ID="rb1" runat="server" GroupName="one" />

this radio button is part of <ItemTemplate>

When the page is executed multiple radio buttons are getting displayed but the GroupName is not working. I can select all the radio buttons. How can I check which radio button is checked?

one more thing, I am using C#


feed the creative machine
0
mp417
9/6/2005 8:50:13 AM

At last I found the solution to this problem,
I am using following control
<input type="radio" id="one" name="one" runat="server" value=<%# DataBinder.Eval(Container.DataItem,"somevalue") %> onclick="change(this)" />

Write a client side function to to manage the selection of the radio buttons,

<script language="javascript">

function change(v)

{

            for(i = 0; i < document.forms[0].elements.length; i ++)

            {

                  elm = document.forms[0].elements[ i ]

                  if (elm.type == 'radio')

               {

                              if (elm.value == v.value)

                              {

                                       elm.checked = true;

                                 }

                              else

                              {

                                    elm.checked = false;

                                }

            }

}

}

</script>

In the Code behind use following,

System.Web.UI.HtmlControls.HtmlInputRadioButton selectedRadio = rptItem.FindControl("one") as System.Web.UI.HtmlControls.HtmlInputRadioButton;

if (selectedRadio != null && selectedRadio.Checked)

{  

Response.Write(selectedRadio.Value);

}


feed the creative machine
0
mp417
9/6/2005 11:02:30 AM
Reply:

Similar Artilces:

How to programmatically access "Create User" button in CreateUserWizard control and "Log In" button in Login control?
Hello, How can I programmatically access "Create User" button in CreateUserWizard control? Also how can I programmatically access "Log In" button in Login control?  Improving lifestyles for luxury pets: TheFabulousPet Hi, here is the way in this example I change only the buttons text on page load (you didn't specify what property exactly want to access):Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load Login1.LoginButtonText = "test" CreateUserWizard1.CreateUserButtonText = "test2" End ...

Radio button controls and Validation control
Hi, I have a group of radio button controls. I want to force user to selecte one those. If not, show a message. I tried to use a RequiredFieldValidator, but ControlToValidate shows nothing. I can check each radio button and check if any is selected, but am sure there is a smarter way. Maybe using a validator. Would you let me know? Thank you, J required field validator validates some inputs like date, integer, string .  you cannot validate the checkbox using a requiredfield validator.Got what you needed. Please mark as answer. Well, they are radiobutto...

Radio Button in Repeator Control
Hi, I am using radio button in repeator control I am using following code: <asp:Repeater ID="repLeads" runat="server"> <ItemTemplate> <tr align="center"> <td align="center" class="record_text"> <asp:radiobutton ID="mstrLead_ContactId" groupname="Lead_Contact" Runat=server /> </td> <td class="record_text"><asp:Label ID="lblHidden" Visible=False text='<%# Container.DataItem("Assn_ContactId")%>' Runat=se...

Is it possible to access values from a repeater control with the button outside of the repeater?
Is it possible to get the values from a repeater when the button firing is outside of the repeater?  Here's how it is set up: 1 <asp:Repeater ID="rpTraining" runat="server" DataSourceID="sdsTraining"> 2 <ItemTemplate> 3 ........ 4 </ItemTemplate> 5 </asp:Repeater> 6 7 <asp:LinkButton ID="lbRegister" runat="server" Text="Register" OnClick="lbRegister_Click" /> I tried the following and it didn't work. Label titl...

Radio buttons in repeater control
Hi,I'm using a radiobutton inside a repeater control, and would like only one radio button to be selectable. Ive put a GroupName property on the radiobutton, but this seems to only make the radiobutton mutually exclusive to other radio buttons in the item template. How can i do this?Thanks,Curt. Regards, Curt  Take Html Input RadioButton instead of server control and set groupname property Click on 'Mark as Answer' if this post is helpful.ImranKhan pathan Are you sure groupname is a valid property of the <input> tag though? Ive tried it and it doesn't...

Control Option button (radio button) using script
I try to control the Checked_Changed event of radio button but it failed. I copy the exact same code to button script event and it worked well.Anybody know what is the issue?? Can somebody explain me and guide me?  Thanks.here is my code: Protected Sub CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) Me.TextBox1.Text = "Click on script"Me.TextBox1.Enabled = FalseEnd Sub   And here is another part: <asp:RadioButton ID="RadioButton1" runat="server" GroupName="a" Style="position: static" OnCheckedCha...

Radio button inside repeator control
Hi I am creating radio button inside the repeator control. following is the code for that <asp:Repeater ID="repLeads" runat="server"> <ItemTemplate> <tr align="center"> <td align="center" class="record_text"> <asp:radiobutton ID="mstrLead_ContactId" groupname="Lead_Contact" Runat=server /> </td> </tr> </ItemTemplate> </asp:Repeater> Being in the single group...

Repeater Control and Dynamic Radio Buttons
Hi,I have a webform allowing users to select one option from a list of radio buttons, when they click a button I then want to identify which dynamic radio button they selected. This form will also be used to force a dynamic radio button to be selected. I am trying to work out how to do 2 things:-1) how to identify which radio button has been selected2) how to force a radio button to be selected I have a repeater control that contains an asp:RadioButton:-                <asp:Repeater ID="Rep_SS" ...

single selection radio button in repeater control?
Hi, The below code  is perfectly fine except it select multiple choices instead of single choice? Any help will be great?<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" CodeFile="repeater.aspx.cs" Inherits="repeater" Title="Untitled Page" %> <%@ Import Namespace="System.Data" %> <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"> <asp:Repeater ID="parentrepeater" runat="se...

HTML radio button in Repeater control not working
I have a child and master page combination. Child page contain the <form> tag. On the child page there is a repeater control showing list of addresses. User can select any address and move ahead to next page. I am using HTML Radio button controls with runat=server attribute for address selection. On runtime I am setting the value property of the radio with the addressID. The problem is when I move the <form> tag from child to master page, the first radio control being populated doesn't work (means: if user has selected first address and he submit the page then on the server...

how to find radio button checked in repeater control?
Hi there, I am trying to do a small survey application .when I click my submit button How to find which radio button checked in repeater control checked and thenI would like to submit  those questions and answers to  a table. Can anyone help me?  <%@ Page Language="C#" AutoEventWireup="true" CodeFile="radiorepeater.aspx.cs" Inherits="radiorepeater" %> <%@ Import Namespace="System.Data" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xht...

Trouble with radio buttons in repeater. (MetaBuilders Control)
I'm using the MetaBuilder Global Radio Button control found here: http://metabuilders.com/Tools/GlobalRadioButton.aspx I'm having trouble setting the GroupName of this control in a repeater. I want to have multiple groupings on the page (3 right now), and would like the groupings to be named radAnswer1, radAnswer2, radAnswer3.  When using the HTML radio button I used this code: name='radAnswer<%=(iQuestionNumber)%>' and it works great.  However, this is not working for this control.  I basically have a Questions page and nested repeaters.  For each question, I h...

Button control in wizard Control
hi all, Gud day to you... i have used a wizard for an application.. i placed a button name '<<back' at run time.. i can show the attributes of the button which i gave in the design page... <asp:Button ID="StepBackButton" runat="server" BackColor="White" BorderColor="#507CD1" BorderStyle="Solid" BorderWidth="1px" CausesValidation="False" CommandName="MovePrevious" Font-Names="Verdana" Font-Size="0.8em" ForeColor="#284E98" Text="<<Back" Visi...

Several questions about best control to use and adding radio buttons to the control
I have a form that is to be used to add or edit records consisting of two text boxes for adding or changing values and a table, grid or list containing rows made up of a field for a radio button and two string fields.  A pair of form level radio buttons indicates add or edit. There are also two form level buttons. The change button adds the new row or overwrites the edited row.  The submit button writes it all to the database. When adding records, the values in the text boxes need to be added to the list or table that has a column for a...

Web resources about - access Radio button button in repeater control..........how? - asp.net.presentation-controls

Repeaters - Wikipedia, the free encyclopedia
Kyle Halsted, Sonia Logan, and Michael Weeks are inmates at a rehabilitation facility. Bob Simpson, the administrator, tasks them with apologizing ...

Repeater Locator on the App Store on iTunes
Get Repeater Locator on the App Store. See screenshots and ratings, and read customer reviews.

Consumers warned to beware of illegal mobile phone repeaters
Use of devices sold online as legitimate solution is in fact dangerous and can land you in jail, regulator warns.

Grim repeater: HIV on the rise
CANDLES flicker in the chilly night air as Jesse Hooper appears on the giant cinema screen overlooking Melbourne&#8217;s Federation Square. He&#8217;s ...

Telstra suspects underbelly of illegal repeaters
'Tens' busted each year. Telstra engineers suspect a "vast" undercurrent of illegal repeaters are causing issues for the carrier's Next G mobile ...

Hands on: Cel-Fi mobile repeater
If your home is a mobile blackspot then a Cel-Fi mobile repeater might help you stay connected.

Amped Wireless R20000G, SR20000G, and UA2000: Routers, Repeaters, and Adapters
... and throughput when pointed at your wireless router/access point. Rounding out the review, Amped sent a third product, their SR20000G repeater, ...

Extending your network's range with a wireless repeater
... your cable modem has to live on one end of your house, leaving the other far away from your wireless signal. That's where a wireless repeater ...

Brooke Mueller, Lindsay Lohan, Demi Moore: Celebrity Rehab Repeaters (PHOTOS)
Brooke Mueller is off the wagon again, shockingly returning to rehab for the 19th time. Although that number is extreme, rehab has unfortunately ...

Computer networking: wireless networks (wifi), routers, repeaters & more - CNET Reviews
Computer networking reviews and ratings, video reviews, user opinions, most popular network hardware, wireless network buying guides, prices, ...

Resources last updated: 2/9/2016 9:50:54 AM