OnChange

S

Steven Cheng[MSFT]

Hello Peter,

I've just downloaded the "combobox" control and performed some test, I
think the combobox control is composite of two built-in controls:
a dropdownlist(html <select> element) and a textbox(<input type="text"
...../>). And there has added many additional client-side scripts to
manipulate the composite control.

As for the select change event of the combobox control, it is processed
through the following path:

1. user change the <select> element's item

2 #1 will trigger the select item's onchange client event,

3 the event handler(defined by the control) in #2 will call the textbox's
onchange event handler(defined ) by the control.

So there is no direct client-side "onchange" event for the combobox
control. since the source code is available, I suggest you consider
customizing it and add an additional property like "onClientChange" and let
the develper specify client-sdie onchange handler. Also, you need to modify
the original code which register the client-side onchange handlers(for the
<select> and textbox) and add your own client-side handler functions( a
placeholder).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial

response from the community or a Microsoft Support Engineer within 1
business day is

acceptable. Please note that each follow up response may take approximately
2 business days

as the support professional working with you may need further investigation
to reach the

most efficient resolution. The offering is not appropriate for situations
that require

urgent, real-time or phone-based interactions or complex project analysis
and dump analysis

issues. Issues of this nature are best handled working with a dedicated
Microsoft Support

Engineer by contacting Microsoft Customer Support Services (CSS) at

http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no rights.
 
E

Eliyahu Goldin

Peter,

You need to know what html is produced for the control. Browser option "View
Source" will give you an idea. Then you will need to figure out how to get
to the exact html element you want to attach an event to.
 
P

Peter

Steven Cheng said:
Hello Peter,

I've just downloaded the "combobox" control and performed some test, I
think the combobox control is composite of two built-in controls:
a dropdownlist(html <select> element) and a textbox(<input type="text"
..../>). And there has added many additional client-side scripts to
manipulate the composite control.

As for the select change event of the combobox control, it is processed
through the following path:

1. user change the <select> element's item

2 #1 will trigger the select item's onchange client event,

3 the event handler(defined by the control) in #2 will call the textbox's
onchange event handler(defined ) by the control.

So there is no direct client-side "onchange" event for the combobox
control. since the source code is available, I suggest you consider
customizing it and add an additional property like "onClientChange" and
let
the develper specify client-sdie onchange handler. Also, you need to
modify
the original code which register the client-side onchange handlers(for the
<select> and textbox) and add your own client-side handler functions( a
placeholder).

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead



==================================================

Get notification to my posts through email? Please refer to

http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.



Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial

response from the community or a Microsoft Support Engineer within 1
business day is

acceptable. Please note that each follow up response may take
approximately
2 business days

as the support professional working with you may need further
investigation
to reach the

most efficient resolution. The offering is not appropriate for situations
that require

urgent, real-time or phone-based interactions or complex project analysis
and dump analysis

issues. Issues of this nature are best handled working with a dedicated
Microsoft Support

Engineer by contacting Microsoft Customer Support Services (CSS) at

http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================



This posting is provided "AS IS" with no warranties, and confers no
rights.

Thanks for your help

I have one question:

In your answer you said

"Also, you need to modify
the original code which register the client-side onchange handlers(for the
<select> and textbox) and add your own client-side handler functions( a
placeholder)."

Can you tell me where is the code that registers the client-side handlers
(What's the name of the method) ?


Thanks


Peter
 
S

Steven Cheng[MSFT]

Hi Peter,

You can lookup the control methods in the "ComboBox.cs" file, I found the
following methos which are helpful to you:

protected override void OnPreRender(System.EventArgs e) {
========================
Most of the scripts (defined in template file) are registered into page in
this function. You can find those scripts and do some customization if you
want.


protected override void AddAttributesToRender( HtmlTextWriter writer ) {
=========================
In this method, the "onchange" client-side event handler is added into the
html <select> tag, you can consider modify it to involve some of your own
script functions in the "onchange" attribue value.

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,810
Latest member
Kassie0918

Latest Threads

Top