|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Overriding Calendar.CreateChildControlsI am trying to subclass the Calendar Web Control to achieve the following. I need to split each Calendar Cell in two parts - AM & PM parts. AM & PM parts are populated by a List<TimeEntryDetail> custom collection. An user can click in eather to adjust the entered information. I want to trach the Click & DoubleClick events on the server. I have tried hooking into the DayRender event, clearing the e.Cell.Controls collection and adding two new custom controls TimeDetailDay which define Click & DoubleClick events and know how to render the AM & PM part respectively. That gave me the desired calendar look but the events did not fire. I gues I need to derive a custom control from Calendar and override the CretaeChildControls method. The thing is there is no way to get a hold of the internal Table control that's used to hold the calendar cells. Any advise on how to approach this is very appreciated. Or do I just need to write a custom calendar control from scratch in order to do this? Krassimir Hello Krassimir,
The DayRender event is triggered later than the page initialization stage and therefore any dynamically added controls will not retain their ViewState upon postback. “Because the DayRender event is raised while the Calendar control is being rendered, you cannot add a control that can also raise an event, such as LinkButton. You can only add static controls, such as System.Web.UI.LiteralControl, Label, Image, and HyperLink.†http://msdn2.microsoft.com/en-us/library/system.web.ui.webcontrols.calendar.dayrender(VS.80).aspx However, using the advice of Microsoft, as quoted above, you can use static controls in combination with some JavaScript to generate a postback event from another server control on the web form to achieve the same effect. Here is one demonstration of such a programming strategy for this task: http://www.webswapp.com/codesamples/aspnet20/calendar/default.aspx Show quoteHide quote "krassimir" wrote: > Hi All, > > I am trying to subclass the Calendar Web Control to achieve the following. I > need to split each Calendar Cell in two parts - AM & PM parts. AM & PM parts > are populated by a List<TimeEntryDetail> custom collection. An user can click > in eather to adjust the entered information. I want to trach the Click & > DoubleClick events on the server. > > I have tried hooking into the DayRender event, clearing the e.Cell.Controls > collection and adding two new custom controls TimeDetailDay which define > Click & DoubleClick events and know how to render the AM & PM part > respectively. That gave me the desired calendar look but the events did not > fire. > > I gues I need to derive a custom control from Calendar and override the > CretaeChildControls method. The thing is there is no way to get a hold of the > internal Table control that's used to hold the calendar cells. > > Any advise on how to approach this is very appreciated. Or do I just need to > write a custom calendar control from scratch in order to do this? > > Krassimir
Are you sure? for delete in GridView
FormView vs create How to get CommandField and ButtonField in the toolbox? Binding TextBox paging control? GridView and DetailsView/FormView in seperate pages FormView sample that includes edit/delete? DataView, DataTable, or DataSet? Creating Dynamic controls Disable CommandField for some rows of data |
|||||||||||||||||||||||