473,657 Members | 2,355 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<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 1615
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
programmaticall y 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(objec t sender, EventArgs e)
{ Calendar calendar1;
DateTime time1;
int num1;
DateTime time2;
num1 = 1;

L_0003:
calendar1 = new Calendar();
time2 = DateTime.Now;
calendar1.Today sDate = time2.AddMonths (num1);
time2 = DateTime.Now;
calendar1.Selec tedDate = time2.AddMonths (num1);
this.PlaceHolde r1.Controls.Add (calendar1);
num1 = (num1 + 1);
if (num1 <= 12)
{
goto L_0003;

}

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

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim calGen As Calendar
Dim intMonths As Integer
Dim dt As DateTime
For intMonths = 1 To 12
calGen = New Calendar
calGen.TodaysDa te = Date.Now.AddMon ths(intMonths)
calGen.Selected Date = Date.Now.AddMon ths(intMonths)
PlaceHolder1.Co ntrols.Add(calG en)
Next
End Sub
"js" <h2*******@NOSP AMwebuser.net> wrote in message
news:Qh******** *************** @bgtnsc04-news.ops.worldn et.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$******** ******@TK2MSFTN GP09.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
programmaticall y 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(objec t sender, EventArgs e)
{ Calendar calendar1;
DateTime time1;
int num1;
DateTime time2;
num1 = 1;

L_0003:
calendar1 = new Calendar();
time2 = DateTime.Now;
calendar1.Today sDate = time2.AddMonths (num1);
time2 = DateTime.Now;
calendar1.Selec tedDate = time2.AddMonths (num1);
this.PlaceHolde r1.Controls.Add (calendar1);
num1 = (num1 + 1);
if (num1 <= 12)
{
goto L_0003;

}

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

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArg s) Handles MyBase.Load
Dim calGen As Calendar
Dim intMonths As Integer
Dim dt As DateTime
For intMonths = 1 To 12
calGen = New Calendar
calGen.TodaysDa te = Date.Now.AddMon ths(intMonths)
calGen.Selected Date = Date.Now.AddMon ths(intMonths)
PlaceHolder1.Co ntrols.Add(calG en)
Next
End Sub
"js" <h2*******@NOSP AMwebuser.net> wrote in message
news:Qh******** *************** @bgtnsc04-news.ops.worldn et.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
2515
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 button, th calendar is not closing. here is the select.js file x999NS4compatible = (document.layers); var x999IE4compatible = (document.all); var x999dayabbs = ;
44
919
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 put either tag inside an HTML <TD> and have the same kind of scrolling effect. This would allow me to fill the screen and have the size of the scrolling box change on resize. Thanks in advance.
0
1084
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 above example is NOT using the <asp:Calendar> control - I'm merely using it as an example of the sort of formatting I'd like to use with an <asp:Calendar> control.
0
1820
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, everything works okay. I can press <ENTER> when the cursor is inside the text box and the page is running, and no events fire (this is what I expect). But as soon as I drop a second text box on the page (ie: after th first one) then pressing...
3
2914
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 (something like the Calendar in Microsoft Outlook)... Can this be done? Or do I have to build that from scratch?
0
986
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 control? 2) If you are using it, how are you using it? E.g. user control, popup
2
2658
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" OtherMonthDayStyle-CssClass="calOtherMonthDay" />
2
10718
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 browser. I wrote the following code in the HTML code for the web form: <%@ Page language="c#" Codebehind="WebForm2.aspx.cs" AutoEventWireup="false" Inherits="calendar.WebForm2" %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" > <HTML>...
0
3323
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 would like to get the code for connecting the javascript to asp.net page... Please help me... The javascript code is as follows..
0
8399
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8827
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8606
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7337
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4159
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2732
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1959
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.