Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Building Controls > Custom control is naming it's components differently

Reply
Thread Tools

Custom control is naming it's components differently

 
 
Nathan Sokalski
Guest
Posts: n/a
 
      01-04-2007
I have written a custom control that uses AJAX (it implements
IPostBackDataHandler and ICallbackEventHandler). I have tested it, and it
seems to work the way I want. However, when I used it in another application
of mine it named the components as ControlID$ComponentID instead of
ControlID:ComponentID. I did not change any of the code, so obviously
something else is making this happen. I need to have it name the components
using ControlID:ComponentID so that my code works. What might be causing
this different naming method? Thanks.
--
Nathan Sokalski
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/


 
Reply With Quote
 
 
 
 
Riki
Guest
Posts: n/a
 
      01-04-2007
I don't know the cause of your problem, but I suggest that you don't try to
predict the ID's of your controls, since the naming system may change in
future versions of ASP.NET.

Instead, use MyControl.ClientID to get the real ID of your controls.

--

Riki

"Nathan Sokalski" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have written a custom control that uses AJAX (it implements
>IPostBackDataHandler and ICallbackEventHandler). I have tested it, and it
>seems to work the way I want. However, when I used it in another
>application of mine it named the components as ControlID$ComponentID
>instead of ControlID:ComponentID. I did not change any of the code, so
>obviously something else is making this happen. I need to have it name the
>components using ControlID:ComponentID so that my code works. What might be
>causing this different naming method? Thanks.
> --
> Nathan Sokalski
> (E-Mail Removed)
> http://www.nathansokalski.com/
>



 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      01-04-2007
That would work, except for one small problem: I'm not talking about the id.
When using AJAX, the IPostBackDataHandler interface is implemented, which
contains a function called LoadPostData. This function has parameters called
postDataKey and postCollection. To access the values of the different
components, you use postCollection(postDataKey & "$ddlYear"). The expression
postDataKey & "$ddlYear" evaluates to the client name, not the client id. I
do not know of a property or function that returns the client name, so this
is the only method I know of to get the component values, and it is also how
I have seen it done by other people. Any ideas? Thanks.
--
Nathan Sokalski
(E-Mail Removed)
http://www.nathansokalski.com/

"Riki" <(E-Mail Removed)> wrote in message
news:O1HJvr%(E-Mail Removed)...
>I don't know the cause of your problem, but I suggest that you don't try to
>predict the ID's of your controls, since the naming system may change in
>future versions of ASP.NET.
>
> Instead, use MyControl.ClientID to get the real ID of your controls.
>
> --
>
> Riki
>
> "Nathan Sokalski" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>>I have written a custom control that uses AJAX (it implements
>>IPostBackDataHandler and ICallbackEventHandler). I have tested it, and it
>>seems to work the way I want. However, when I used it in another
>>application of mine it named the components as ControlID$ComponentID
>>instead of ControlID:ComponentID. I did not change any of the code, so
>>obviously something else is making this happen. I need to have it name the
>>components using ControlID:ComponentID so that my code works. What might
>>be causing this different naming method? Thanks.
>> --
>> Nathan Sokalski
>> (E-Mail Removed)
>> http://www.nathansokalski.com/
>>

>
>



 
Reply With Quote
 
Peter Zolja
Guest
Posts: n/a
 
      01-19-2007
> postDataKey & "$ddlYear" evaluates to the client name, not the client id.
> I do not know of a property or function that returns the client name, so
> this


UniqueID


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM
Custom control is naming it's components differently Nathan Sokalski ASP .Net 3 01-19-2007 06:39 PM
Custom control is naming it's components differently Nathan Sokalski ASP .Net Web Controls 3 01-19-2007 06:39 PM
Javax.naming Exception: name not found in naming service. Harman Java 1 07-28-2006 08:51 AM
Naming data access components Chris Fulstow ASP .Net 6 04-14-2006 03:01 PM



Advertisments