PDA

View Full Version : [CLOSED] Why is TextField's clientID is not the same as the actual input id



jchau
Aug 18, 2008, 1:52 PM
I added a TextField (txtName) to my page and want to access the input on the clientside or assign an Ajax Toolkit Extender to it. When I view the html of the page, the input id is actually txtName_Input. I think that's very confusing to .NET developers who are used to a control's clientid being the control's html id, especially since there's no method/property on TextField to get the input's clientID. Right now, I have to just hardcode txtName.ClientID & "_Input".

Edit: oops, excuse the grammatically incorrect title.

geoffrey.mcgill
Aug 18, 2008, 2:24 PM
Hi jchau,

The "[ClientID]_Input" <input> field was used to work around a ViewState issue during the earlier release(s) of the Toolkit. We've since come up with a better technique and with the v0.6 release, the "[Client]_Input" has been removed.

Now the <input> field is created dynamically with JavaScript on the client when the page loads, or more specifically, when the DOM is ready. You should be able to now reference the <input> field directly with it's .ClientID.

Hope this helps.

jchau
Aug 18, 2008, 2:41 PM
One step ahead of me, awesome =P. v0.6 is shaping up to be a massive release. Can't wait!

One more question. If the textbox is created dynamically, will it be available in time for Ajax Toolkit Extenders to reference it during the ASP.NET Ajax Init event of page?

geoffrey.mcgill
Aug 18, 2008, 2:57 PM
> v0.6 is shaping up to be a massive release.

indeed it is.

> If
the textbox is created dynamically, will it be available in time for
Ajax Toolkit Extenders to reference it during the ASP.NET Ajax Init
event of page?

I'm not really sure how, or at what point the Ajax Extender client-side event handlers get attached, although what I do know for sure is that the <input> field will not be available until after the Ext.onReady() event. The onReady event happens early, although maybe not early enough for the Extenders to attach to. This is a bit of an unknown at this point.

Does the Extender need to attach at a .NET Control or can it attach to a standard html <input> field?

What Extender are you using? It would always be best to use an Ext native extension. Maybe an extension exists which can remove the requirement for the Ajax Extender.

jchau
Aug 18, 2008, 3:10 PM
geoffrey.mcgill (8/18/2008)>
Does the Extender need to attach at a .NET Control or can it attach to a standard html <input> field?


The Extender attaches to a standard html input field that's part of the DOM.


geoffrey.mcgill (8/18/2008)>
What
Extender are you using? It would always be best to use an Ext native
extension. Maybe an extension exists which can remove the requirement
for the Ajax Extender.


I am just investigating compatibility between Coolite and ASP.NET AJAX. I may use the AutoComplete extender that attaches to a textbox. I will try it when v0.6 is released. If it doesn't work, I can settle with using Ext native extensions. However, not sure how others may feel if Coolite is not compatible with ASP.NET AJAX. Personally, I would love to drop ASP.NET AJAX all together and just use Coolite once it's fully released. UpdatePanels are evil. The only reason I am still using ASP.NET AJAX now is for the ease of creating client components with server side support.

jchau
Aug 18, 2008, 3:32 PM
Just did a quick test. Ext.onReady runs before ASP.NET AJAX pageInit and pageLoad client events. So I think we are all good =P. I posted another thread last week about extending ExtJS and using it in Coolite. It would be great if u can take a look. I just ran into another situation where I needed a SearchField that extends Ext.form.TriggerField.

geoffrey.mcgill
Aug 18, 2008, 3:46 PM
jchau (8/18/2008)I may use the AutoComplete extender that attaches to a textbox.
The <ext:ComboxBox> will be included with the v0.6 release. This may help replace the AutoComplete extender. Or, another option with be the <AjaxEvents>, which could be attached to the keystrokes. There will be lots of options.


jchau (8/18/2008)However, not sure how others may feel if Coolite is not compatible with ASP.NET AJAX.
The Coolite Toolkit works perfectly in conjunction with the ASP.NET AJAX framework, maybe even better than the native asp.net web controls do. We're not limited by many of the restrictions of old-school asp.net web controls and ajax extenders. My only point is, I'm not sure at what stage the Extenders try to attach themselves on the client. If it's later than Ext.onReady then there shouldn't be any problems. Again, we're only talking about the Ajax Extenders, of which, there's always (or will be) a better solution within Coolite or Ext.


jchau (8/18/2008)UpdatePanels are evil.
yes and no. This is certainly an area where the Coolite Toolkit controls will work much better with the <asp:UpdatePanel> than native asp.net web controls. I've been having a lot of fun with <asp:UpdatePanels>'s recently. Like any tool, it's just depends on how it's being used.


jchau (8/18/2008)The only reason I am still using ASP.NET AJAX now is for the ease of creating client components with server side support.
Version 0.6 release will certainly help with adding server-side event handling support. An <AjaxEvent> can be attached to any Control (or html element) and any event. It's incredibly powerful and this functionality does not currently exist in the asp.net space.

Hope this helps answer some of your questions.

jchau
Aug 18, 2008, 7:15 PM
jchau (8/18/2008) Just did a quick test. Ext.onReady runs before ASP.NET AJAX pageInit and pageLoad client events. So I think we are all good =P. I posted another thread last week about extending ExtJS and using it in Coolite. It would be great if u can take a look. I just ran into another situation where I needed a SearchField that extends Ext.form.TriggerField.


I take that back. It works fine in IE7 but in FF3, it's random which event fires first. This is crazy...

geoffrey.mcgill
Aug 18, 2008, 7:29 PM
In FireFox, both libraries might be looking for the same trigger to fire their "onReady" events which creates a race. First one wins and that might be random.

jchau
Aug 28, 2008, 9:19 PM
geoffrey.mcgill (8/18/2008)In FireFox, both libraries might be looking for the same trigger to fire their "onReady" events which creates a race. First one wins and that might be random.


Is there a way to make this not random? There are many cases where I need to access an ASP.NET AJAX client component during Ext.onReady().

geoffrey.mcgill
Aug 31, 2008, 6:36 PM
jchau (8/28/2008)Is there a way to make this not random? There are many cases where I need to access an ASP.NET AJAX client component during Ext.onReady().


It might be tricky. As mentioned earlier, I'm unsure of the
client-side lifecycle of the ASP.NET AJAX and at what point they start
attaching events/listeners.



At some point I'm going to have to come up with an *official* policy
regarding support for the ASP.NET AJAX Extension library within the Coolite Toolkit, although at the moment there is very little desire to provide any AJAX Extension support. If it works "out-of-the-box" then great, otherwise please let us know what AJAX Extension feature you require and we should be able to come up with a pure Coolite/ExtJS replacement.


We are building a much more powerful framework (client+server) and most of us are here
because we know there is a better alternative.