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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T08:49:16+00:00 2026-06-10T08:49:16+00:00

Im using a javascript to enable disable textboxes and to calculate a price based

  • 0

Im using a javascript to enable disable textboxes and to calculate a price based on what radiobutton is checked.

The problem I have is that I use the groupname of the radiobutton, to find the correct textbox, and use it’s value in the calculation. When the repeater creates the code from my itemtemplate it does not use the supllied arguments to create an name.

My name in the item tag is:
name='<%# DataBinder.Eval(Container.DataItem, “idtag_domain”) %>’
The name it creates is name=”Repeater1$ctl02$textbox” aswell as the name tag i supplied.
For the radiobuttons their name becomes
Repeater1$ctl01$sverigemotrasism
isnted of just
sverigemotrasism
Is there a way to stop it from creating names… or how do I circumvent that?

This is my itemtemplate

    <ItemTemplate>
    <asp:RadioButton id="RadioButton1" runat="server" GroupName='<%# DataBinder.Eval(Container.DataItem, "idtag_domain")%>' value="50" Text="Fri tillgång" onclick="calculatePrice();disableTB(this.name);"  />
    <br />
    <asp:RadioButton id="RadioButton2" runat="server" GroupName='<%# DataBinder.Eval(Container.DataItem, "idtag_domain")%>' 
        Text="En artikel om dagen(30/mån)" value="25" onclick="calculatePrice();disableTB(this.name);" />
         <br />
    <asp:RadioButton id="RadioButton3" runat="server" GroupName='<%# DataBinder.Eval(Container.DataItem, "idtag_domain")%>'  value="0"
        Text="Skriv antalet artiklar" onclick="enableTB(this.name, this.checked)" />
         <br />
    <asp:TextBox ID="textbox" runat="server"  name='<%# DataBinder.Eval(Container.DataItem, "idtag_domain") %>' Enabled="false" Width="106px" 
        onkeyup="calculatePrice()" style="background-color:#eeeeee" ></asp:TextBox>
    </ItemTemplate>

My javascript does this! To find out what textbox was clicked.

function enableTB(tbname, checked) 
{
var textboxen = tbname;
document.getElementById(textboxen).disabled = !checked;
document.getElementById(textboxen).style.background = '#C4F8CC';
}

function disableTB(tbname)
{
var textboxen = tbname + 1;
document.getElementById(textboxen).disabled = true;
document.getElementById(textboxen).style.background = '#eeeeee';
}

Unfortunately this is what my source code looks like after the repeater has created everything…
Repeater data!

    <table>  

     <input id="Repeater1_RadioButton1_0" type="radio" name="Repeater1$ctl01$sverigemotrasism" value="50" onclick="calculatePrice();disableTB(this.name);" /><label for="Repeater1_RadioButton1_0">Fri tillgång</label>
     <br />
    <input id="Repeater1_RadioButton2_0" type="radio" name="Repeater1$ctl01$sverigemotrasism" value="25" onclick="calculatePrice();disableTB(this.name);" /><label for="Repeater1_RadioButton2_0">En artikel om dagen(30/mån)</label>
         <br />
    <input id="Repeater1_RadioButton3_0" type="radio" name="Repeater1$ctl01$sverigemotrasism" value="0" onclick="enableTB(this.name, this.checked);" /><label for="Repeater1_RadioButton3_0">Skriv antalet artiklar</label>
         <br />
    <input name="Repeater1$ctl01$textbox" type="text" id="Repeater1_textbox_0" disabled="disabled" class="aspNetDisabled" onkeyup="calculatePrice()" name="sverigemotrasism" style="width:106px;background-color:#eeeeee" />



    <tr>
    <td>




    </td>
    </tr>

     <input id="Repeater1_RadioButton1_1" type="radio" name="Repeater1$ctl02$handlaihop" value="50" onclick="calculatePrice();disableTB(this.name);" /><label for="Repeater1_RadioButton1_1">Fri tillgång</label>
     <br />
    <input id="Repeater1_RadioButton2_1" type="radio" name="Repeater1$ctl02$handlaihop" value="25" onclick="calculatePrice();disableTB(this.name);" /><label for="Repeater1_RadioButton2_1">En artikel om dagen(30/mån)</label>
         <br />
    <input id="Repeater1_RadioButton3_1" type="radio" name="Repeater1$ctl02$handlaihop" value="0" onclick="enableTB(this.name, this.checked);" /><label for="Repeater1_RadioButton3_1">Skriv antalet artiklar</label>
         <br />
    <input name="Repeater1$ctl02$textbox" type="text" id="Repeater1_textbox_1" disabled="disabled" class="aspNetDisabled" onkeyup="calculatePrice()" name="handlaihop" style="width:106px;background-color:#eeeeee" />
  • 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-10T08:49:18+00:00Added an answer on June 10, 2026 at 8:49 am

    If you’re using the framework 4.0 you could use static ids for your controls. Try setting
    ClientIDMode = Static

    Sometimes you don’t want your ID values to be nested hierarchically, though, and instead just want the ID rendered to be whatever value you set it as. To enable this you can now use ClientIDMode=static, in which case the ID rendered will be exactly the same as what you set it on the server-side on your control.

    If you use name property you should be using getElementsByName instead of getElementById Probably you want to set the textbox id instead of the name. Take into account that id property must to be unique for each control.

    I’m not sure if GroupName will be static using above suggested setting. It’s worth to test it, if doesn’t work, you could set the CssClass property with the same value and use it as key to search the textbox.

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

Sidebar

Related Questions

I have a validator which I can enable or disable using the following javascript:
I am using the below function of javascript to enable and disable the radio
I'm using JavaScript to enable/disable stylesheets using the following: document.styleSheets[0].disabled = true|false; This JS
I need to be able to enable and disable a linkbutton using javascript as
I am using the JavaScript to disable keyboard if checkbox is not checked and
I am trying to enable and disable a required field validator using javascript but
How can i disable or enable File upload control of .NET framework using Javascript??
i want to enable facebox jquery using javascript. here in normal html <a href=stairs.jpg
Using Twitter Bootstrap's [Tabbable Tabs][1], it says to: Enable tabbable tabs via javascript (each
Using JavaScript, is it possible to use prototype to add a method to a

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.