.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
satyapriyanayak
Subhransu Sekhar Jena
abhays
SP
DotnetUser
Post New Web Links

Multiple radio buttons

Posted By:      Posted Date: April 10, 2011    Points: 0   Category :WPF
 
I'm programming on C#, and I've a groupBox containing multiple radioButtons, Can anyone tell me how can i determine the checked radio button (at any time not at the radioButton checked event)?
Please give an example code.



View Complete Post


More Related Resource Links

Using ReportViewer for multiple reports by way of radio buttons

  
 Hi all, Thanks for taking the time to read over my scenario.  I am using one ReportViewer with already established SQL Stored Procedures connected to three report files (*.rdlc).  There are three radio buttons which are to be associated with each report that needs to be displayed in the ReportViewer.  Here is an example if a radio button is selected:ReportViewer1.Reset() Dim rds As Microsoft.Reporting.WebForms.ReportDataSource rds = New Microsoft.Reporting.WebForms.ReportDataSource ReportViewer1.LocalReport.DataSources.Clear() If RadioButtonList1.SelectedIndex = 0 Then rds.DataSourceId = ObjectDataSource1.ID rds.Name = "spEx1" rds.Value = ObjectDataSource1 ReportViewer1.LocalReport.DataSources.Add(rds) ReportViewer1.LocalReport.ReportPath = "Ex1Report.rdlc" ... The ReportViewer works for the first radio button selection but then for the other selection I get the following error: A data source instance has not been supplied for the data source 'spEx1' I'm not sure exactly what is going on or where it's still tied to the first data source.  Any help would be great!  Thank you.

Gridview with Radio Buttons

  
As now, Radio buttons are HTML controls, I am not able to get it on server side. When user select any radio button and press submit, Control will not available at code behind, you can use "e.Item.FindControl" as it is not "runat='server'". I want ID "Primary Key" value for selected radio button. To achive this I took the help of Javascript. I wrote javascript function that sets the values of "Primary Key" in hidden field when user clicks on any radio button. Now when user clicks on Submit button, user can get selected value froim hidden field.

single form multiple buttons in MVC

  

In a single page  has two buttons , ddown and tempname.

I wrote two actionresult separetly each one for ddown and tempname.

I need one is post and another one is get method. so i gave like

1. Get Method

------------------

[ActionName("ddown")]
        [AcceptVerbs(HttpVerbs.Get)]
        [AcceptParameter(Name = "button", Value = "tempname")]
        public ActionResult ddown_tempname(string statusName, NewsLetterAdminViewModel viewModel)
        {

return View();

}

 

2.Post Method

------------------

[ActionName("ddown")]
        [AcceptVerbs(HttpVerbs.Post)]
        [AcceptParameter(Name = "button", Value = "ddown")]
        public ActionResult ddown(string statusName, string button, NewsLetterAdminViewModel viewModel, FormCollection collection)
        {

return View();

}

 

if i call the post method its worked well. but if i call the get method, the code does not execute. the brea

Ajax.BeginForm with multiple buttons

  

can i have more than one AjaxOptions in Ajax.BeginForm targetting different controls?


Actually I want to exchange data between two listboxes placed in a single ajax.beginform.

How to do it..................help me.


Series of Radio Buttons in MVC

  

Hi.  I'm fairly new to MVC and admittedly don't fully understand how data is passed between Views and Controllers.  That said, here is my issue.

 

I am working with C#.  I have a page which has a list of items.  Each item has a radio button set of three associated with it and there are 15 of these sets on the page.  Thus I have radio1, radio2....radio15, etc.  Each of these has value 0, 1, or 2 upon submit.  I can't seem to understand how to get the information out of these radio button sets from the controller without passing 15 different variables to the post method in the controller which is associated with the view; ie passing Int32 radio1, Int32 radio2,.., Int32 radio15, etc.

I tried using ViewData["radio"+i] in a loop to access the value of each radio button set, but this, apparently can only be used to pass data to the View from the Controller and not the other way around.

Any advice is appreciated.

 

-Crystal.


groupBox radio buttons

  
Hello   On my form, I've got two groupbox's and each group box has two radio buttons. I believe the expected operation, is that if one is checked , the other is not with in the groupbox. How can I make it so only one is checked among the four?

Problem with radio buttons in a repeater

  

I can use the asp control and find the radio buttun in the code behind when a button is clicked but the user can select multiple buttons, or I can use an html input type radio and be able to select only one button of the group but not find it in the button's click event.  Is there a way to both be able to find the radio button AND have it di what it's supposed to - only allow one to be checked?


How can I process multiple buttons with one click event?

  

I want to dynamically build a table where each of the first three cells may or may not contain an image.  If a cell contains an image, it may or may not contain a radio button.  The last cell contains a button or link button.  I want all the buttons to be handled by the same click event.  The number of rows, which cells will have an image, and which cells will have a radio button is not known at design time.  Finally, the images are displayed using the better image control.

I'm trying to get this to work usinging a repeater, but at the moment I can't get the radio button checked propety to change from the default value.  I'm using an arraylist as a datasource.  I thought of using a gridview, but I don't know how to add a radio button and a better image control to a cell. 

I've gone round and round with this thing. Each time after a lot of work I find there is something I can;t get working.  Is there a reasonable solution for this? 

I'm back to wanting to build a table, but how do I handle the buttons?


Radio Buttons - OnChange

  

I'm having a time finding out I could not do something simple as :

On the onchange event getting the new selected checkbox, this with jquery.

The checkboxes are located in the following div :

<div id="radio">
                <%= Html.RadioButton("radio1", "Ja", Model.Status == 1 ? true : false) %><label for="radio1">Ja</label> 
                <%= Html.RadioButton("radio2", "Nee", Model.Status == 0 ? true : false) %><label for="radio2">Nee</label> 
                <input type="hidden" id="radioValue" name="radioValue" />
</div>


This all located in a form, when I will find out the selected radio on change I will post the form and use the value of the hidden field to know the selected radion button. Nothing realy difficult.

The js code :

$("input[type='radio']", "#radio").change(function(e) {
        
      // Get the selected radio button

    });

Any help appreciated.


How to find unselected radio buttons using JQuery?

  

I would like to find which radiobutton group (not individual radiobutton) has not been checked, tried a lot of different ways, no success so far. What I want to do is find validate radiobutton groups and highlight them.

$('input:radio:not(checked')).each(function() {
                 $(this).css("background-color","blue");
 });

thanks


IE 9 Beta & InfoPath 2007 Form Radio Buttons Not Working

  

Hi,

Has anyone else come across the IE9 bug that causes the radio buttons in the InfoPath 2007 forms to stop working (i.e. unselectable)?

Did you find a workaround (other than not to use IE9!)?

Thanks,

Steve


Radio Button Enable Disable Multiple Panel

  

using c# asp.net i m able to achieve the enable and disable through auto postback

but i want this thing to achieve by javascript can anyone help me

Default Page

protected void Button1_Click(object sender, EventArgs e)
    {
        string url = "default2.aspx?";
        url += "sid=" + Server.UrlEncode(DropDownList1.SelectedItem.Text.Trim());
        Response.Redirect(url);
    }

Default 2

protected void Page_Load(object sender, EventArgs e)
    {
        Panel1.Visible = false;
        Panel2.Visible = false;
        Panel3.Visible = false;
        Panel4.Visible = false;
        if (!IsPostBack)
        {
            if (Request.QueryString != null)
            {
                Label1.Text = Request.QueryString["sid"].ToString();
            }
        }
    }

    protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
    {
        if (Request.QueryString["sid"] == "new")
        {
            Panel1.Visible = true;
            Panel2.Visible = false;
        }
        if (Request.QueryString["sid"] == "old")
        {
            Panel3.Visible = true;
            Panel4.Visible = false;
        }
    }
    protected void RadioButton2_CheckedChanged(object sender, EventArgs e)
 

Selecting radio buttons in a gridview with dataset from Linq Query

  

Hi Everyone!

I've got a gridview that will allow clients to edit options they've already entered on another page.  The gridview has three radio buttons in it each with a value of 1,2,3.  The option value in the dataset is 1,2 or 3 respectively.  I would like to have the radiobutton with the corresponding value selected in the gridview so they can see what they previously chose and will then be able to edit, if they wish.

How do I do this? 


Here's my code so far:

Dim clientOption = (From c In dc.ClientOptions _
                                 Where c.clientID = userClientID _
                                 Select New With {c.clientOptionID, _
                                                  c.optionWording, _
                                                  c.optionValueID}).ToList()


            'Now Populate Gridview 1 with set options
            If clientOption Is Nothing Then
                Label1.Text = "There are currently no set options to edit."

            Else
                GridView1.DataSource = clientOption
                GridView1.DataBind()
                Label1.Text = "Edit set options."
            End If

            
            <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="F
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend