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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T13:43:27+00:00 2026-05-23T13:43:27+00:00

How do I dynamically create a table based on months and number of days?

  • 0

How do I dynamically create a table based on months and number of days? For example, I want to display a rolling 3 months on one row and then show the Sunday day on the second row underneath the month like below. Not sure if I should use server side code or client side code, etc.

JULY                  AUGUST    SEPTEMBER
3 10 17 24 31    7 14 21 28    4 11 18 25

  • 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-23T13:43:28+00:00Added an answer on May 23, 2026 at 1:43 pm

    using server side code or client side code depends on your project status so see my sample server side code

    Code Behind

    protected void Page_Load(object sender, EventArgs e)
    {
        List<Int32> Months = new List<Int32>() { 7, 8, 9 };
        if (!IsPostBack)
        {
            gv.DataSource = Months;
            gv.DataBind();
        }
    }
    protected void gv_DataBinding(Object sender, RepeaterItemEventArgs  e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Literal ltrMonth = e.Item.FindControl("ltrMonth") as Literal;
            DateTime _date = new DateTime(DateTime.Now.Year, (Int32)e.Item.DataItem, 1); 
            ltrMonth.Text = _date.ToString("MMMM");
             DateTime temp;
             List<Int32> sundays=new List<Int32>();
             for(var i=1;i<32;i++)
             {
                 if(DateTime.TryParse(_date.Year+"/"+_date.Month+"/"+i,out temp))
                 {
                     if(temp.DayOfWeek==DayOfWeek.Sunday)
                     {
                         sundays.Add(i);
                     }
                 }
             }
    
    
            Repeater rptrSunday = e.Item.FindControl("rptrSunday") as Repeater;
            rptrSunday.DataSource = sundays;
            rptrSunday.DataBind();
        }
    }
    protected void rptrSunday_DataBinding(Object sender, RepeaterItemEventArgs e)
    {
        if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
        {
            Literal ltrDay = e.Item.FindControl("ltrDay") as Literal;
            ltrDay.Text = e.Item.DataItem.ToString();
        }
    }
    

    ASPX

    <asp:Repeater runat="server" ID="gv" OnItemDataBound="gv_DataBinding">
        <HeaderTemplate>
            <table>
            <tr>
        </HeaderTemplate>
        <ItemTemplate>
                <td>
                    <asp:Literal runat="server" ID="ltrMonth"></asp:Literal>
                    <table>
            <tr>
                <td>
                    <asp:Repeater runat="server" ID="rptrSunday" OnItemDataBound="rptrSunday_DataBinding">
                        <ItemTemplate>
                            <asp:Literal runat="server" ID="ltrDay"></asp:Literal></ItemTemplate>
                    </asp:Repeater>
                </td>
            </tr></table>
                </td>
        </ItemTemplate>
        <FooterTemplate>
            </tr>
            </table></FooterTemplate>
    </asp:Repeater>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Basically i want to be able to dynamically create a temp table based off
How does one dynamically create table cells based on a dataset? Is Javascript/ajax required
On Page_Init I create a table of dynamically created controls based on a couple
Within SQL Server 2005, I need to create a table dynamically based upon the
In My application i need to create a table with dynamically creating Rows based
I would like to dynamically create a minimal transparent bar graph to display over
I have a table with one row in my HTML file. Now in jQuery
I am still stuck up in this problem. I want to create dynamically multiple
How do I dynamically create $_POST lines in php, based om extractions from MYSQL.
In C# Given a hash table like {id:'1', name:'foo'} How can I dynamically create

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.