|
Rank: Newbie Groups: Member
Joined: 6/16/2010 Posts: 4
|
I have a date picker and would like to register a change event in the pre render event. The event I prefer is ClientSideOnChange, but I could use any client event that corresponds to the selection of a date. What event could I use DatePicker.Attributes.Add for in the prerender event?
Code: C#
protected void RevisedCloseDatePickerInsert_PreRender(object sender, EventArgs e)
{
DatePicker RevisedCloseDatePicker = (DatePicker)ClosingFormView.FindControl("RevisedCloseDatePicker");
//RevisedCloseDatePicker.Attributes.Add("ClientSideOnChange", "RevisedCloseDatePickerInsertChange();");
}
|
|
Rank: Newbie Groups: Member
Joined: 6/16/2010 Posts: 4
|
Ok, I can do this: RevisedCloseDatePicker.ClientSideOnChange = "RevisedCloseDatePickerInsertChange"; but how do I pass parameters dynamically? Is it even possible?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, You do not pass parameter to an event handler. An event handler takes a list of pre-defined arguments (just like your Page_Load always takes two arguments). The DatePicker would pass the event arguments to your handler. If you would like to call another function with your own argument, you would need to put that code inside a different function such as:
Code: JavaScript
function event_handler_function(predefined_arguments......)
{
another_function(your_own_arguments....);
}
Then use "event_handler_function" with the controls. Thanks!
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
I am having a similar issue. I have a DatePicker within a repeater. I want it to trigger a javascript function when the user selects a date, but how can the javascript function know which instance of the DatePicker called it? Is there any way at all to pass a parameter from the DatePicker to a client side function?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
quirtep wrote:Is there any way at all to pass a parameter from the DatePicker to a client side function? The only thing the DatePicker passes to the client side function is the DatePicker itself. You can not pass your own parameters.
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
Is there an alternative method of accomplishing what I describe?
|
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
There could be but it won't have anything to do with our control so there isn't much we can do for you. Basically all we can tell you is what you are looking for does not exist here and the rest is yours. Our support won't devise a solution for you.
|
|
Rank: Advanced Member Groups: Member
Joined: 9/6/2007 Posts: 133
|
Umm, ok, but I would think that a basic example of your calendar control within standard repeater or other such template, would be simple support...
|
|