how generate dynamic controls based on selecton user?
i had appeared 1 practical test had below mentioned requirements
they had 2 calendars (asp.net default).
they had 2 options (radio button list) : 1 "repeat on" , "repeated on"
the repeat on had 2 drop down :
1) day dropdown: values were: every, every other day, every third day
2) duration dropdown: values were: day, month, week, year
the repeated on had 2 drop down :
1) week: values first week, second week, third week
2) day: sunday, monday .... saturday
now when click first calendar's date august 10 2010 , second 1 january 26 2011, wanted dynamic calendars should generated show calendars august january (inclusive of both)
for filter purpose, if select first sunday (from repeated on option) first sunday of dynamic calendars should selected. if select every third day every 3rd day should selected (in dynamic generated calendars)
what did : generate dynamic calendars creating object of calendar class.. right? plus searched on google , show dayrender event possible solution didn't help...
how that? how generate dynamic calendar?
please let me know if question not being understood.
pass me on code similar least
thanks!
sounds want set properties calendar.selecteddate
, calendar.visibledate
.
i'm not sure you're going since don't know type of control user selecting jan 1/jun 1 dates from, or 3rd sunday has that. there 1 calendar? please explain little more if info below doesn't you.
i'll paste vb code 1 of apps, out.
protected sub calarrival_selectionchanged(byval sender object, byval e system.eventargs) handles calarrival.selectionchanged setformdepartureentry() lblarrivaldate.text = calarrival.selecteddate.tolongdatestring caldeparture.selecteddate = calarrival.selecteddate caldeparture.visibledate = calarrival.selecteddate dtselectedarrival = "1/1/2000" 'determine if need see 2 months view possible departure dates. if (datepart(dateinterval.month, caldeparture.selecteddate) <> _ datepart(dateinterval.month, dateadd(dateinterval.day, 14, caldeparture.selecteddate))) caldeparture2.visible = true caldeparture2.selecteddate = nothing caldeparture2.visibledate = dateadd(dateinterval.month, 1, caldeparture.selecteddate) else caldeparture2.visible = false end if end sub
ok have posted details becomes different question. don't know how many calendars need want create them in code. suggest using panel control in markup contain possible result calendars. suggested earlier, create new calendar objects needed , add them "anchor" panel's controls collection.
calendar objcal = new calendar(); pnlresultscontainer.controls.add(objcal);
as far setting selected days, can have 1 "selected" day per calendar believe. can set rendering styles, , whether day enabled, etc., handling calendar.dayrender event. maybe can me out on setting handler dynamically created controls in c#? think it's like:
objcal.dayrender += addressof(dynamicdayrenderhandler());
please correct if not right.
determining correct day set styles on in handler matter of coding against dayrendereventargs.day object parameter of event. don't know offhand how find specific days/intervals looking should possible little research in following articles:
how to: customize individual days in calendar web server control
dayrendereventargs.day property
hope helps.
Comments
Post a Comment