Showing posts with label calendar. Show all posts
Showing posts with label calendar. Show all posts

Thursday, March 29, 2012

set date on calendar in a FormView template

Hi,

My calendar is inside a FormView template as users are entering new dates.

I want the month shown to be the same as the last one they entered, but after an Insert, the control revert back to the current month.

I can fetch the moth via SQL or stoer in a cookie, but I don't know how to access the control, as it's embedded in the FormVIew.

Thanks if you can help.

NEIL

1protected void myFormView_DataBound(object sender, EventArgs e)2 {3 Calendar myCal = (Calendar)myFormView.FindControl("myCalendar");4// set the Visible Date in the calendar to the Current Month5 myCal.VisibleDate = DateTime.Now();6 }

Line 3 finds the Calendar Control within the FormView.

Line 5 sets the VisibleDate property of the calendar to the Current Month, or whatever date you want to place on the right side of the =.


Hi,

I'm writing in VB, can you translate?

Cheers,

NEIL


1Protected Sub FormView1_DataBound(ByVal senderAs Object,ByVal eAs System.EventArgs)Handles FormView1.DataBound2Dim myCalAs Calendar =CType(FormView1.FindControl("myCalendar"), Calendar)3 myCal.VisibleDate = DateTime.Now4End Sub
 
If this is what you needed, please mark it as your answer...Thanks!!
 

Thursday, March 22, 2012

Set Minimum Date Calendar Control

Does anyone know how to set a minimum selectable date in the calendar
server control that come with VS2005?

I do not want to use validators...I want the days before the selectable
period to be grayed out.Wow. I guess most people do not use this control. I am now wishing I
had some funds to purchase a date control that is actually useful!

I'll try another Q: How do I make a date to show as selected/shaded
(preselect) when the calendar is rendered on my web page? I tried
setting both the "TodaysDate" and "SelectedDate" properties with code.
I then set a breakpoint and verified that this is happening...but the
user still has to click on the day in the calendar to get it to show as
selected/shaded. Does anyone have any ideas?

Joey wrote:
> Does anyone know how to set a minimum selectable date in the calendar
> server control that come with VS2005?
> I do not want to use validators...I want the days before the selectable
> period to be grayed out.
Got the second Q answered. I was setting those properties to DateTime
variables which had values like "1/1/2006 4:24:23 PM". Once I changed
them to "1/1/2006 12:00:00 AM" it worked...strange.

Still working on the first Q.
Does that mean that you don't need to have
"funds to purchase a date control that is actually useful" ?

;-)

Juan T. Llibre, asp.net MVP
aspnetfaq.com : http://www.aspnetfaq.com/
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en espaol : http://asp.net.do/foros/
===================================
"Joey" <joey.powell@.topscene.com> wrote in message
news:1142452273.636929.143820@.e56g2000cwe.googlegr oups.com...
> Got the second Q answered. I was setting those properties to DateTime
> variables which had values like "1/1/2006 4:24:23 PM". Once I changed
> them to "1/1/2006 12:00:00 AM" it worked...strange.
> Still working on the first Q.