473,497 Members | 2,166 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Can't access control created in Calendar 'DayRender' event

Hi

Can anyone help with a quick question?

I am adding a textbox into each "day" cell of a calendar control, by
using the following code in the DayRender event:
Protected Sub Calendar1_DayRender(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.DayRenderEventArgs) Handles
Calendar1.DayRender
If Not e.Day.IsOtherMonth Then
Dim txtDayCell As New TextBox
txtDayCell.ID = "txtMonth" & e.Day.DayNumberText
e.Cell.Controls.Add(txtDayCell)
End If
End Sub
My problem is that when I then try to access the textbox value in
PageLoad, I get an 'Object reference not set to an instance of an
object' error at the line I've highlighted in my 'test' code below
Protected Sub Page_Load(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.Load

Dim txtMonth1 As New TextBox
txtMonth1 = Page.FindControl("txtMonth1")

Dim Button1 As New Button
Button1 = Page.FindControl("Button1")

If Me.IsPostBack Then
Button1.Text = txtMonth1.Text **** Error is thrown here
*****
End If

End Sub
I suspect I've not quite got my timing right with the page lifecycle
side of this - could anyone suggest how I can access the textboxes in
the calendar cells. from a postback?

Many thanks for your help guys.

Mark
Nov 20 '08 #1
0 1730

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

Similar topics

0
2477
by: Michael Craig | last post by:
Hello, I have written an application using the calendar control in a regular aspx application, to prove I could get the functionality I wanted. Which is to display the current month and populate...
4
2000
by: Bruce W..1 | last post by:
When someone clicks on a day in my Calendar control I want to postback to the same page but with information in a querystring, different for each day. Rather than posting back twice by using its...
2
3624
by: Chuck Hartman | last post by:
I've been trying to add an ImageButton object to a Calendar table cell, but so far I am unable to handle the Command event from that button in my form's code behind. Below is an example of what I...
2
1756
by: Trond | last post by:
I'm having a problem when creating several calendars in a web form. Here's a snippet of my code: ****************************** public string username; private void CreateCalendars() {...
2
1012
by: Quentin Huo | last post by:
Hi: I want to present some massages in the calender control. Can I do that? Thanks Q.
1
1273
by: DougS | last post by:
Is it possible to highlight more than one date in the calendar control? I'm trying to display a calendar to the user and highlight the dates that have action items. Is this possible? Or is this...
3
1173
by: Paul | last post by:
Hi, I have a calendar control for a .net web application and was wondering if it is possible to change the appearance of some of these days when the page loads? The application loads date...
1
1668
by: Dabbler | last post by:
I'm trying to customize calendar days using data in a table. Some days may have corresponding rows in the table giving counts for that day. I'm not clear on when I should get the data from the...
0
1461
by: tom c | last post by:
I have an ASP.Net app that uses the calendar control to select a report for a particular date. Reports exist for most dates, but not all, so I would like to highlight the dates for which the...
0
7120
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,...
0
6991
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
7196
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6878
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
5456
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,...
1
4897
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4583
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...
0
3088
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...
1
649
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.