473,394 Members | 1,935 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

<asp:Calendar> question

js
Any way to modify an <asp:Calendar> tag with parameters on the fly? Seems
I'm not allowed to use the <% =xxx %> substitution for parameters to the
<asp:Calendar> tag.

Do I have to do code behind procedures to intercept the creation of the
Calendar to modify the parameters using DOM?

Looking to generate multiple calendars, for different months, using a C#
programming loop rather than in-line code in the .aspx file.
Nov 18 '05 #1
2 1592
Maybe this isn't what you're after, but it sounds like you might be able to
put a placeholder control on the form and then add your calendars
programmatically in the code behind. The following is C#, converted from VB
by Lutz Roeder's .NET Reflector (http://www.aisto.com/roeder/dotnet/)

private void Page_Load(object sender, EventArgs e)
{ Calendar calendar1;
DateTime time1;
int num1;
DateTime time2;
num1 = 1;

L_0003:
calendar1 = new Calendar();
time2 = DateTime.Now;
calendar1.TodaysDate = time2.AddMonths(num1);
time2 = DateTime.Now;
calendar1.SelectedDate = time2.AddMonths(num1);
this.PlaceHolder1.Controls.Add(calendar1);
num1 = (num1 + 1);
if (num1 <= 12)
{
goto L_0003;

}

}
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</form>
VB Code is here:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim calGen As Calendar
Dim intMonths As Integer
Dim dt As DateTime
For intMonths = 1 To 12
calGen = New Calendar
calGen.TodaysDate = Date.Now.AddMonths(intMonths)
calGen.SelectedDate = Date.Now.AddMonths(intMonths)
PlaceHolder1.Controls.Add(calGen)
Next
End Sub
"js" <h2*******@NOSPAMwebuser.net> wrote in message
news:Qh***********************@bgtnsc04-news.ops.worldnet.att.net...
Any way to modify an <asp:Calendar> tag with parameters on the fly? Seems
I'm not allowed to use the <% =xxx %> substitution for parameters to the
<asp:Calendar> tag.

Do I have to do code behind procedures to intercept the creation of the
Calendar to modify the parameters using DOM?

Looking to generate multiple calendars, for different months, using a C#
programming loop rather than in-line code in the .aspx file.

Nov 18 '05 #2
js
thanks, I'll try it.
"Ken Cox [Microsoft MVP]" <BA************@sympatico.ca> wrote in message
news:O$**************@TK2MSFTNGP09.phx.gbl...
Maybe this isn't what you're after, but it sounds like you might be able to put a placeholder control on the form and then add your calendars
programmatically in the code behind. The following is C#, converted from VB by Lutz Roeder's .NET Reflector (http://www.aisto.com/roeder/dotnet/)

private void Page_Load(object sender, EventArgs e)
{ Calendar calendar1;
DateTime time1;
int num1;
DateTime time2;
num1 = 1;

L_0003:
calendar1 = new Calendar();
time2 = DateTime.Now;
calendar1.TodaysDate = time2.AddMonths(num1);
time2 = DateTime.Now;
calendar1.SelectedDate = time2.AddMonths(num1);
this.PlaceHolder1.Controls.Add(calendar1);
num1 = (num1 + 1);
if (num1 <= 12)
{
goto L_0003;

}

}
<form id="Form1" method="post" runat="server">
<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>
</form>
VB Code is here:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
Dim calGen As Calendar
Dim intMonths As Integer
Dim dt As DateTime
For intMonths = 1 To 12
calGen = New Calendar
calGen.TodaysDate = Date.Now.AddMonths(intMonths)
calGen.SelectedDate = Date.Now.AddMonths(intMonths)
PlaceHolder1.Controls.Add(calGen)
Next
End Sub
"js" <h2*******@NOSPAMwebuser.net> wrote in message
news:Qh***********************@bgtnsc04-news.ops.worldnet.att.net...
Any way to modify an <asp:Calendar> tag with parameters on the fly? Seems I'm not allowed to use the <% =xxx %> substitution for parameters to the
<asp:Calendar> tag.

Do I have to do code behind procedures to intercept the creation of the
Calendar to modify the parameters using DOM?

Looking to generate multiple calendars, for different months, using a C#
programming loop rather than in-line code in the .aspx file.


Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: vinu | last post by:
I have a javascript file named select.js. This is a file which is use to pop up a calendar, when clicked on a calendar icon in an ASP file. have a close button in the calendar. When i click on the...
44
by: Jim M | last post by:
I have had great success with using <iframe> with overflow-y set to auto. I can get a similar look with the <iframe> tag. BUT... In all cases I need to have fixed heights. Is there a way to...
0
by: Mark Rae | last post by:
Hi, Is there any way to show the SelectedDay as, say, a red circle? Something like this: http://www.visualasp.com/vcdl/monthview/monthview_multiple_monthviews.asp N.B. I realise that the...
0
by: Tom Edelbrok | last post by:
I'm using VS 2005 to develop an intranet asp.net web application and I get a weird situation. If I start out with any ASPX page that contains an ImageButton control followed by a TextBox control,...
3
by: WB | last post by:
Hi, Is it poosible to build an appointment planner on a webform using asp:Calendar control? I would like to display one month at a time and show all the appointments scheduled in every day...
0
by: Mark Rae | last post by:
Hi all, Just canvassing people's opinions on the <asp:Calendar> control, specifically in v2. I'm interested to know: 1) Are you using it? If not, is that because you prefer a 3rd-party...
2
by: Mark Rae | last post by:
Hi, Has anyone found a fix for the <asp:Calendar/ CSS bug whereby certain attributes (mainly colours) are not rendered correctly? E.g. <asp:Calendar ID="calTest" runat="server"...
2
by: Sreenath Rao Nellutla | last post by:
Hai all, I am trying to create dropdown calendar control with HTML input control by writing JavaScript. But while executing I am getting the error as "Error on Page" on the status bar of the...
0
by: mathewgk80 | last post by:
HI all, I am having popup calendar Javascript code. But i dont know how it is connecting to asp.net code.. I am using asp.net,c#.net and also using 3tier architecture with master page.... I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.