473,395 Members | 1,670 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,395 software developers and data experts.

where did the methods for a component go???

Hello,

Using VWD 2005 here... I have a GridView and for usability, the edit
template for one of the columns was changed from the defaut to a
calendar control.

Also, I have some content which I want to add to the calendar...
something akin to this MSDN example...
http://www.asp.net/QuickStart/util/s.../Calendar5.src

On the code behind page, where the class and method name comboboxes
are, the calendar and it's methods isn't there! What happened to the
component and its methods? To put custom content in the calendar, like
the example, the DayRender method is needed.

Suggestions are greatly appreciated.

Thanks!

Jun 5 '06 #1
1 1001
Hi all,

A week ago, I tried something like this to get access to a calendar's
methods which are part of the edit item template in my gridview:

Dim WithEvents myCalendar As New Calendar

Protected Sub GridView1_RowDataBound(ByVal sender As Object,
ByVal e As
System.Web.UI.WebControls.GridViewRowEventArgs) Handles
GridView1.RowDataBound

If e.Row.RowType = DataControlRowType.DataRow Then
myCalendar =
Me.GridView1.Rows(myRow).FindControl("Calendar1")
AddHandler calView.DayRender, AddressOf
calView_DayRender
End If

End Sub

This fails miserably with a null reference exception. I'm confused as
to why it's looking for the new keyword here... is that for the event
handler then?

So after some more reading, I tried this...

'
'
'
Protected Sub GridView1_Load(ByVal sender As Object, ByVal e
As System.EventArgs) Handles
GridView1.Load
Dim editField As New TemplateField
editField.EditItemTemplate = New
CompiledBindableTemplateBuilder(AddressOf buildCalendar, Nothing)
GridView1.Columns.Insert(3, editField)
End Sub

'
'
'
Sub buildCalendar(ByVal ctl As Control)
Dim ipa As IParserAccessor = ctl
Dim cal As Calendar = New Calendar
cal.TemplateControl = Me
cal.ID = "editCalendar"
AddHandler cal.DayRender, AddressOf renderCalendar
ipa.AddParsedSubObject(cal)
End Sub

'
'
'
Sub renderCalendar(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DayRenderEventArgs)

Dim myCal As Calendar = CType(sender, Calendar)
myCal.ID = "editCalendar"

'
' stuff which follows would be for the calendar cell
background color and text rendering one can do in
' DayRender...
'
End Sub

This solution does indeed make an edit item template with a calendar as
the component... but there are two problems...

1. I want the edit item to be a part of column 3. But what this thing
does is create a totally new column at runtime, inserts it, and shifts
the other columns one index to the right.

2. When a user clicks a day an additional, blank, column is added to
the grid.

Can anyone help with the 2 problems I still have? Thanks!

Jun 13 '06 #2

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

Similar topics

3
by: Mayer Goldberg | last post by:
Can someone please explain the motivation behind the following restriction in the language: I define an interface and two classes implementing it: public interface InterA {} public class B...
3
by: barb | last post by:
I'm developing an assembly that will be used from ASP (not ASP.NET). Can I overload methods? My initial tests suggest that I can't. Thanks, Barb
0
by: Jonathan Allen | last post by:
We have found that our method of testing does not match traditional text-book methodologies. I decided to write a short white paper on it so that I could get your opinions. Does anyone else use...
2
by: Mo | last post by:
Hi all, rookie question: I have built a component with one class declared as public. The class has one function declared as public. The function takes one parameter. I register the component....
18
by: Exits Funnel | last post by:
Hello, I'm a little confused about where I should include header files and was wondering whether there was some convention. Imagine I've written a class foo and put the definition in foo.h and...
8
by: Michael McDowell | last post by:
I'm confused: "why do we need to assign a method to a delegate then assign the delegate to an event why not just assign the method to the events event handler" and "how does making a...
17
by: Picho | last post by:
Hi all, I popped up this question a while ago, and I thought it was worth checking again now... (maybe something has changed or something will change). I read this book about component...
2
by: Åženol Akbulak | last post by:
Hi; I am developing an 3 tiered application. And my user interface is an ASP.NET web application. My methods in BLL only uses own parameters and DAL. Now my methods are not static. I heard that...
6
by: Diego F. | last post by:
Hello. I'm using the socket class in an application and I use socket.receive to wait for data. The problem is that the interface gets locked while the receive method is executing. I want to see...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
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
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...
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.