Jacob Jacob - 1 year ago 226
ASP.NET (C#) Question

Trying to center calendar control in visual studio c#

I am using visual studio and programming in c# however I am facing a problem in trying to center Calendar control in a Panel

I centered everything in the panel including radiobuttons , checkboxes , textboxes but the two calendars are stuck on the left side of the panel and I can't seem to move it anywhere else on the design page

I tried Calendar.CaptionAlign Property but it didn't seem to work


Is there any helpful code I can use under

protected void Calendar1_SelectionChanged(object sender, EventArgs e) {



Answer Source

You can do it with CSS. Go to Content folder in your project and find Site.css file. Then add some CSS-class for your calendars at the bottom of this file:

.calendar {
    display: block; 
    width: 200px;
    margin: 0 auto;

Then set CssClass property of your calendars to "calendar".

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download