Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8786427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T21:37:29+00:00 2026-06-13T21:37:29+00:00

Gridview multiple radiobuttons in a row I have three RadioButtons in a row in

  • 0

Gridview multiple radiobuttons in a row

I have three RadioButtons in a row in a Gridview. I need to get the checked status, but it never changes when you select a button.
Here is the code:

    <asp:TemplateField>
         <ItemTemplate>
               <asp:RadioButton runat="server" GroupName="venc" ID="rdo0" Checked="True" />
         </ItemTemplate>
       </asp:TemplateField>

       <asp:TemplateField HeaderText="2° Venc.">
         <ItemTemplate>
              <asp:RadioButton runat="server" GroupName="venc" ID="rdo3"    />
          </ItemTemplate>
       </asp:TemplateField>


    protected void gvCuotas_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        for (int i = 2; i < 5; i++)
        {
            radio = (RadioButton)fila.FindControl("rdo" + i);
            if (radio.Checked)
               {
                  vencimiento = i; //never gets here.
                  break;
               }
            }
        }
   }

ASP.

<asp:GridView ID="gvCuotas" runat="server" AutoGenerateColumns="False" 
                        Caption="Cuotas Pendientes"  capCellSpacing="2" CellPadding="2" 
                    HeaderStyle-BackColor="Aqua" HorizontalAlign="Center" Width="80%" 
                        BorderStyle="Solid" onrowcommand="gvCuotas_RowCommand" 
                        onrowdatabound="gvCuotas_RowDataBound" >

Behind:

public partial class Cuota1 : System.Web.UI.Page
{
    DataClasses1DataContext baseAlumnos = new DataClasses1DataContext();

    protected void Page_Load(object sender, EventArgs e)
    {

        var cuotas = from p in baseAlumnos.Cuotas where p.Pagado.Equals(0) 
                     select new { p.Mes, p.Observacion, p.Vencimientos, p.Pagado};


        gvCuotas.DataSource = cuotas;
        gvCuotas.DataBind();
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T21:37:30+00:00Added an answer on June 13, 2026 at 9:37 pm

    Modify your Markup to include the OnRowCommand event handler in the gridview

    <asp:GridView runat="server" ID="gv" AutoGenerateColumns="False" OnRowCommand="OnRowCommand">
        <Columns>
            <asp:TemplateField>
             <ItemTemplate>
                   <asp:RadioButton runat="server" GroupName="venc" ID="rdo0" Checked="True"/>
             </ItemTemplate>
           </asp:TemplateField>
    
           <asp:TemplateField HeaderText="2° Venc.">
             <ItemTemplate>
                  <asp:RadioButton runat="server" GroupName="venc" ID="rdo3"    />
              </ItemTemplate>
           </asp:TemplateField>
           <asp:ButtonField HeaderText="Confirm" ButtonType="Button" />
        </Columns>
    </asp:GridView>
    

    Here is the code behind for OnRowCommand event handler

    protected void OnRowCommand(object sender, GridViewCommandEventArgs e)
    {
    
        int index = Convert.ToInt32(e.CommandArgument);
        GridViewRow gvRow = gv.Rows[index]; 
    
        for (int i = 2; i < 5; i++)
        {
            var radio = (RadioButton)gvRow.FindControl("rdo" + i);
            if (radio!=null && radio.Checked)
               {
                  //This point will hit for the selected radiobutton 
                  break;
               }
        }
    }
    

    Please make sure, you are binding your data only on page load, not on page postback.

    protected void Page_Load(object sender, EventArgs e)
    {
        if(!IsPostBack){ 
            var cuotas = from p in baseAlumnos.Cuotas where p.Pagado.Equals(0) 
                     select new { p.Mes, p.Observacion, p.Vencimientos, p.Pagado};
            gvCuotas.DataSource = cuotas;
            gvCuotas.DataBind();
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a gridview with multiple rows, each has a Update button and I
I have multiple radio buttons columns in my gridview, I want to select one
I have a gridview with checkbox inside asp:TemplateField . I wish to select multiple
I have a GridView with multiple items, but the items must be kept selected
I have multiple buttons in gridview. How can i determine which particular button on
I have a gridview where I can select multiple rows by pressing a control
How do I determine which SELECT button was clicked in a GridView? The multiple
I have a gridview control that can get loaded with multiple pages worth of
I have a gridview ...with multiple columns. If I click on one column, it
I have a master-detail page, in which I use GridView to display multiple rows

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.