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

  • Home
  • SEARCH
  • 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 4271038
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T07:23:15+00:00 2026-05-21T07:23:15+00:00

I have written a script which dynamically creates a html table based off server

  • 0

I have written a script which dynamically creates a html table based off server side variables passed through hidden fields. Ideally, I want to add a .NET label and Radio button control to each cell that I can populate server side. I realize that .NET controls are all created when the page is first compiled, but is there anyway to add them later? Here is my code that builds the table:

        <script>
        $(document).ready(function () {
            var satShifts = $('#mainContent_hidSat').val();
            var sunShifts = $('#mainContent_hidSun').val();
            var monShifts = $('#mainContent_hidMon').val();
            var tueShifts = $('#mainContent_hidTue').val();
            var wedShifts = $('#mainContent_hidWed').val();
            var thuShifts = $('#mainContent_hidThu').val();
            var friShifts = $('#mainContent_hidFri').val();

            var c = 0;

            for (var i = 0; i < satShifts; i++) {
                $('#tblSat').append('<tr><td class="individualShift">Shift: ' + ***LABEL & RAD here*** + '</td></tr>');
                c++;
            }
            for (var i = 0; i < sunShifts; i++) {
                $('#tblSun').append('<tr><td class="individualShift">Shift: ' + ***LABEL & RAD here*** + '</td></tr>');
                c++;
            }
            for (var i = 0; i < monShifts; i++) {
                $('#tblMon').append('<tr><td class="individualShift">Shift: ' + ***LABEL & RAD here*** + '</td></tr>');
                c++;
            }
            for (var i = 0; i < tueShifts; i++) {
                $('#tblTue').append('<tr><td class="individualShift">Shift: ' + ***LABEL & RAD here*** + '</td></tr>');
                c++;
            }
            for (var i = 0; i < wedShifts; i++) {
                $('#tblWed').append('<tr><td class="individualShift">Shift: ' + ***LABEL & RAD here*** + '</td></tr>');
                c++;
            }
            for (var i = 0; i < thuShifts; i++) {
                $('#tblThu').append('<tr><td class="individualShift">Shift: ' + ***LABEL & RAD here*** + '</td></tr>');
                c++;
            }
            for (var i = 0; i < friShifts; i++) {
                $('#tblFri').append('<tr><td class="individualShift">Shift: ' + ***LABEL & RAD here*** + '</td></tr>');
                c++;
            }
        });
    </script>
  • 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-21T07:23:15+00:00Added an answer on May 21, 2026 at 7:23 am

    You cannot add them as a .NET control once the page has been loaded. This is by design.

    You can however add them as HTML elements and then access their values in the code-behind using Request.Form["textboxName"].

    You would then set the name value of your textboxes to whatever value you wanted to retrieve them by in the code-behind (In this case, it would be name="textboxName").

    Alternatively, you could render them as ASP.NET controls from the back-end using the server side variables. If this is the route you want to take, I’ll elaborate further.

    Update: Everything you’re trying to do in javascript can be done with Repeaters.

    For each day on the back end, add a repeater that looks like this:

    <asp:Repeater ID="rptSaturdayShifts" runat="server">
       <ItemTemplate>
          <tr><td class="individualShift">Shift: <asp:Label id="lblYourLabel" runat="server" Text='<%# Eval("LabelContent") %>' /> <asp:RadioButton id="rbYourRadioButton" runat="server" /></td></tr>
       </ItemTemplate>
    </asp:Repeater>
    

    You just databind your repeater with a collection that has a “LabelContent” property and voila, your data is rendered. Now, when saving, you’ll have to iterate through all of the repeater rows. So on your “Save” button click:

    foreach (var item in rptSaturdayShifts.Items) 
    {
       var yourRadioButton = (Label) item.FindControl("rbYourRadioButton");
    
       // You can then access it using...
       var radioButtonValue = yourRadioButton.SelectedValue;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a CGI script that creates an image dynamically using GET data.
I have written a ruby script which opens up dlink admin page in firefox
I have written a script that goes through a bunch of files and snips
I have written a news scroller which uses the Prototype and Script.aculo.us libraries to
I have written a script which is basically a small wysiwyg signature generator for
I have written a script that gets data from solr for which date is
I'm using emacs and I have written a script which uses current-buffer. However the
I have written a little script which retrieves pictures and movies from my camera
I have written a small script in Perl which I am executing on Windows
I have written a greasemonkey script which will do GM_xmlhttpRequest to the next 2

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.