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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:49:37+00:00 2026-05-30T07:49:37+00:00

My html. <input id=rdb1 type=radio name=rdbData checked=checked /> <input id=rdb2 type=radio name=rdbData /> <asp:Button

  • 0

My html.

<input id="rdb1"  type="radio" name="rdbData" checked="checked" />
<input id="rdb2"  type="radio" name="rdbData" />
<asp:Button ID="btnTest" runat="server" Text="Test" OnClick="btnTest_Click" />

Button is only asp:button but radio buttons are not.First time when page is load rdb1 is selected.But when i click the button btnTest with check rdb2, page is refreshed and select 1st redio button.To prevent this i try jquery like this.
Inside Document.ready:

var btnTest = "<%=btnTest.ClientID %>";
 $('#' + btnTest).bind("click", function() {
            if ($('#rdb1').attr("checked")) {
                $('#rdb2').attr("checked", false);
                $('#rdb1').attr("checked", true);

            }
            else {
                $('#rdb1').attr("checked", false);
                $('#rdb2').attr("checked", true);
            }
        });

But its not work.How can we handle this type of situation.Where i am getting wrong.Any idea or any alternative.Thanks.

  • 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-05-30T07:49:39+00:00Added an answer on May 30, 2026 at 7:49 am

    I repeat that the requirement is ABSURD. How are they going to tell you used server-side controls without looking at the code anyway. This is like requiring that you write the code using chopsticks or something.

    However just as an exercise I provide the following solution:

    <input id="rdb1"  type="radio" name="rbdData" value="rbd1" <%= Rdb1Checked %> />
    <input id="rdb2"  type="radio" name="rbdData" value="rbd2" <%= Rdb2Checked %> />
    <asp:Button ID="btnTest" runat="server" Text="Test" onclick="btnTest_Click" /> 
    

    And the code behind:

    protected string Rdb1Checked
    {
        get
        {
            if (IsPostBack)
            {
                if (Request["rbdData"] == "rbd1")
                {
                    return "checked";
                }
                else
                {
                    return "";
                }
            }
    
            return "checked";
        }
    }
    
    protected string Rdb2Checked
    {
        get
        {
            if (IsPostBack)
            {
                if (Request["rbdData"] == "rbd2")
                {
                    return "checked";
                }
                else
                {
                    return "";
                }
            }
    
            return "";
        }
    }
    

    Ask why they have these requirements. Maybe they don’t want to see the client IDs in which case you may set the ClientIDMode to Static and avoid auto generated IDs. You can remove them completely by setting them to null, etc. Maybe they don’t like what Web Forms renders for Radio buttons in which case using server side inputs would be OK. The requirement on its own simply does not make sense.

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

Sidebar

Related Questions

I have aps.net web form there is html input text: <input type=text class=input runat=server
Okay so I have a simple HTML Input fragment: <input id=txtFirstName type=text class=txtBox runat=server
I have asp.net(c#) web form with html input text(first name) how i can check
Here is an HTML input text box: <input type=text id=text name=text_name /> What are
I have an HTML input box <input type=text id=foo value=bar> I've attached a handler
I've 2 asp listbox controls and an html input button, and using js i
Is there a quick way to set an HTML text input ( <input type=text
I have html input <input id=txtSearch value=Search... type=text/> Is it possible to animate the
given this html input element, <input id=input1 type=text /> if the user enters a
I am trying to simply bind a HTML Input radio button inside a repeater

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.