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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T19:17:40+00:00 2026-06-13T19:17:40+00:00

This is the code I made before I realized that the Calender control exists.

  • 0

This is the code I made before I realized that the Calender control exists. And please never mind the typo [canlender]!

Somehow this code is making the state of whole IIS [Service Unavailable]. Doing net stop w3svc / net start w3svc won’t work too. The hosting provider said [What have you done?]. On my computer (IIS on Win8) would freeze too.

I don’t find anything that would make the server unable to service. It’s just creating and modifying controls… Any idea about the cause of this problem?

Thanks.

calender.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class member_Default : System.Web.UI.Page {
 protected void Page_Load(object sender, EventArgs e) {
     int currday = 1;
     int len = DateTime.DaysInMonth(DateTime.Now.Year, DateTime.Now.Month);
     switch (new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1).DayOfWeek) {
         case DayOfWeek.Sunday: currday = 1; break;
         case DayOfWeek.Monday: currday = 0; break;
         case DayOfWeek.Tuesday: currday = -1; break;
         case DayOfWeek.Wednesday: currday = -2; break;
         case DayOfWeek.Thursday: currday = -3; break;
         case DayOfWeek.Friday: currday = -4; break;
         case DayOfWeek.Saturday: currday = -5; break;
     }
     TableRow tr = new TableRow();
     TableHeaderCell tst;
     tst = new TableHeaderCell(); tst.CssClass = "single_day"; tst.Text = "Sun"; tr.Controls.Add(tst);
     tst = new TableHeaderCell(); tst.CssClass = "single_day"; tst.Text = "Mon"; tr.Controls.Add(tst);
     tst = new TableHeaderCell(); tst.CssClass = "single_day"; tst.Text = "Tue"; tr.Controls.Add(tst);
     tst = new TableHeaderCell(); tst.CssClass = "single_day"; tst.Text = "Wed"; tr.Controls.Add(tst);
     tst = new TableHeaderCell(); tst.CssClass = "single_day"; tst.Text = "Thu"; tr.Controls.Add(tst);
     tst = new TableHeaderCell(); tst.CssClass = "single_day"; tst.Text = "Fri"; tr.Controls.Add(tst);
     tst = new TableHeaderCell(); tst.CssClass = "single_day"; tst.Text = "Sat"; tr.Controls.Add(tst);
     tblCanlender.Controls.Add(tr);
     int a=0;
     while (currday <= len && a++<50)
     {
         tr=new TableRow();
         for (int i = 0; i < 7; i++) {
             TableCell tc = new TableCell();
             if (currday >= 1 && currday <= len) {
                tc.CssClass = "single_day_body";
                tc.Text = currday.ToString();
                tc.Controls.Add(tc);
                LinkButton lnk = new LinkButton();
                lnk.Text = "Add";
                tc.Controls.Add(lnk);
             }
             tr.Controls.Add(tc);
             currday++;
         }
         tblCanlender.Controls.Add(tr);
     }
 }
}

calender.aspx

<%@ Page Language="C#" EnableViewState ="false" AutoEventWireup="true" CodeFile="calender.aspx.cs" Inherits="member_Default" %>

<style type="text/css">
    .single_day{
           width:80px;
           height:40px;
           background:#DDD;
    }
    .single_day_body{
           width:80px;
           height:80px;
           text-align:left;
           vertical-align:top;
           background:#FFF;
    }
    table, th, tr, td, thead, tbody {
        border: 0;
        margin: 0;
        padding: 0;
    }
    a.insertdate, a.insertdate:visited, a.insertdate:link {
        color:gray;
        text-decoration:none;
    }
    a.insertdate:hover {
        color:#DDD;
    }
</style>
<asp:Table runat="server" id="tblCanlender" style="width:100%;border:1px solid gray;background:#EEE"></asp:table>
  • 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-13T19:17:41+00:00Added an answer on June 13, 2026 at 7:17 pm
    tc.Controls.Add(tc);
    

    are you sure this is intended? it seems like a circular reference.

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

Sidebar

Related Questions

So, i made this code to help me add functions after or before other
I have made this code: var foo=document.createElement(div); var childs=foo.getElementsByTagName(*); console.log(childs.length);//0 OK var a=document.createElement(a); foo.appendChild(a);
I have made this code to open a database(created in SQLite browser) stored in
I am pretty new at C# and .NET, but I've made this code to
How can I improve this code? What has made this long winded is the
So here's what I see this code doing: An array is made A loop
i made a windows service & add project installer.in which only contain this code.
I have a line, which is a sprite made by using this code CGPoint
I have a problem, and I made this test code to show you my
I've made this piece of code, it will re-size images on the fly, if

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.