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 7997949
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T15:05:50+00:00 2026-06-04T15:05:50+00:00

I have the following asp.net code, the user has to select a row with

  • 0

I have the following asp.net code, the user has to select a row with a radiobutton, and I need to disable the button with jquery when there is no radio button selected and enable it again when there is a radio button selected.

<asp:GridView ID="GrvOpenForApproval" runat="server" 
        AutoGenerateColumns="False" Width="100%">
        <Columns>
              <asp:BoundField HeaderText="Dealer" DataField="Dealer.DealerNumber" />
            <asp:BoundField HeaderText="RequestNumber" DataField="RequestNumber" />
            <asp:BoundField HeaderText="Chassis"  DataField="Vehicle.Chassis"/>
            <asp:BoundField HeaderText="Commission" DataField="Vehicle.ComissionNumber" />
            <asp:BoundField HeaderText="Created" DataField="RequestDate" DataFormatString="{0:dd/MM/yyyy}" />
            <asp:BoundField HeaderText="Status"  DataField="CurrentStatus" />
            <asp:BoundField HeaderText="Comment" DataField="Comments" />
            <asp:TemplateField HeaderText="Select One">
            <ItemTemplate>
              <input name="RequestBaseId" type="radio" 
                        value='<%# Eval("RequesBaseId") %>' />
            </ItemTemplate>
          </asp:TemplateField>
        </Columns>
        <HeaderStyle CssClass="gridheader" />
    </asp:GridView>
    <br />
    <div class="clear hideSkiplink">
        <asp:Button runat="server" ID="BtnApproveSelected" 
            meta:resourcekey="BtnApproveSelectedResource" 
            onclick="BtnApproveSelectedClick"/>
    </div>

I tried this but its not working

Ready: function () {
            $('input[name="RequestBaseId"]').click(function () {
                if (!$(this).val()) {
                    $("#BtnApproveSelected").attr("disabled", "disabled");
                }
                else {
                    $("#BtnApproveSelected").attr("disabled", "");
                }
            });
        }

generated html

<div>

    <table cellspacing="0" rules="all" border="1" id="MainContent_GrvOpenForApproval" style="width:100%;border-collapse:collapse;">

        <tr class="gridheader">

            <th scope="col">Dealer</th><th scope="col">RequestNumber</th><th scope="col">Chassis</th><th scope="col">Commission</th><th scope="col">Created</th><th scope="col">Status</th><th scope="col">Comment</th><th scope="col">Select One</th>

        </tr><tr>

            <td>&nbsp;</td><td>1</td><td>&nbsp;</td><td>&nbsp;</td><td>24/05/2012</td><td>Approval1</td><td>123</td><td>

              <input name="RequestBaseId" type="radio"  

                        value='1' />

            </td>

        </tr><tr>

            <td>DEAL-1</td><td>1</td><td>CH1</td><td>123C</td><td>24/05/2012</td><td>Approval1</td><td>12</td><td>

              <input name="RequestBaseId" type="radio"  

                        value='2' />

            </td>

        </tr><tr>

            <td>&nbsp;</td><td>1</td><td>&nbsp;</td><td>&nbsp;</td><td>24/05/2012</td><td>Approval1</td><td>123</td><td>

              <input name="RequestBaseId" type="radio"  

                        value='3' />

            </td>

        </tr><tr>

            <td>DEAL-1</td><td>1</td><td>CH1</td><td>123C</td><td>24/05/2012</td><td>Approval1</td><td>12</td><td>

              <input name="RequestBaseId" type="radio"  

                        value='4' />

            </td>

        </tr><tr>

            <td>DEAL-1</td><td>1</td><td>CH1</td><td>123C</td><td>24/05/2012</td><td>Approval1</td><td>12</td><td>

              <input name="RequestBaseId" type="radio"  

                        value='5' />

            </td>

        </tr>

    </table>

</div>

    <br />

    <div class="clear hideSkiplink">

        <input type="submit" name="ctl00$MainContent$BtnApproveSelected" value="Approve selected request" id="MainContent_BtnApproveSelected" disabled="disabled" class="aspNetDisabled" ClientID="BtnApproveSelected" />

    </div>
  • 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-04T15:05:52+00:00Added an answer on June 4, 2026 at 3:05 pm

    Try this:

    $('input[name="RequestBaseId"]').change(function() {
        if (!$(this).val()) {
            $("#BtnApproveSelected").prop("disabled", true);
        }
        else {
            $("#BtnApproveSelected").prop("disabled", false);
        }
    });
    

    You will also need to add a ClientID to your button:

     <asp:Button runat="server" ID="BtnApproveSelected" ClientIDMode="Static"
            meta:resourcekey="BtnApproveSelectedResource" 
            onclick="BtnApproveSelectedClick"/>
    

    You could also make the input[name="RequestBaseId"] selector better by using a class.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have constructed an ASP.NET user control Box.ascx wtih the following code. <div id=divContent
I have following asp.net code but it gives error when I change dropdown selected
Anything I have tried didn't work. Currenly I have following code to change asp.net
I have the following code in my ASP.NET project public sealed class IoC {
i have the following code in an asp.net mvc view. <% = Html.DropDownList(Filter, new
I have the following code in a ASP.NET master page: <div id=hyperlinkimage><asp:HyperLink ID=SomeHyperLink runat=Server
I am using ASP.NET 3.5 with iTextSharp and I have the following code: var
This is a beginner level question for asp.net MVC I have the following code
In The Page_Load event of an ASP.NET USercontrol, I have the following Code: If
I have somebody elses code (C# ASP.Net) which contains the following query: string query

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.