Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - Override INamingContainer

 
Thread Tools Search this Thread
Old 12-21-2005, 06:27 PM   #1
Default Override INamingContainer


Is there a way to prevent the INamingContainer behaviour that prefixes the
id of server controls in master pages with the format [master page
id]_[content id]_. I would prefer to manage the potential id attribute
conflicts myself, rather than having such verbose id attributes throughout
my site.

Thanks,
~PJ




PJ
  Reply With Quote
Old 12-21-2005, 09:25 PM   #2
Brock Allen
 
Posts: n/a
Default Re: Override INamingContainer
The problem is that you don't know what some other control will emit for
an ID. I imagine what your problem is is that you want to hard code the ID
in your javascript to a well known value. Instead of hard coding, the approach
is to dynamically emit your javascript with the proper ID using the Control.ClientID
property.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> Is there a way to prevent the INamingContainer behaviour that prefixes
> the id of server controls in master pages with the format [master page
> id]_[content id]_. I would prefer to manage the potential id
> attribute conflicts myself, rather than having such verbose id
> attributes throughout my site.
>
> Thanks,
> ~PJ





Brock Allen
  Reply With Quote
Old 12-21-2005, 09:49 PM   #3
PJ
 
Posts: n/a
Default Re: Override INamingContainer
The id is known, one can set the id on the master page, content place holder
controls, etc. The pattern is always the same. I know what the final
rendered id value will be and can set the proper css/javascript selectors
properly ahead of time.

My problem is simply not having total control of the rendered id attributes
and the verbosity of the rendered values.


"Brock Allen" <> wrote in message
news: .com...
> The problem is that you don't know what some other control will emit for
> an ID. I imagine what your problem is is that you want to hard code the ID
> in your javascript to a well known value. Instead of hard coding, the

approach
> is to dynamically emit your javascript with the proper ID using the

Control.ClientID
> property.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
> > Is there a way to prevent the INamingContainer behaviour that prefixes
> > the id of server controls in master pages with the format [master page
> > id]_[content id]_. I would prefer to manage the potential id
> > attribute conflicts myself, rather than having such verbose id
> > attributes throughout my site.
> >
> > Thanks,
> > ~PJ

>
>





PJ
  Reply With Quote
Old 12-21-2005, 09:56 PM   #4
Brock Allen
 
Posts: n/a
Default Re: Override INamingContainer
Sure, of course you can make it work. I think what I was trying to say is
that the pattern is what's documented to potentially change in the future,
thus the preference to use the ClientID property and merge that dynamically
into your javascript.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> The id is known, one can set the id on the master page, content place
> holder controls, etc. The pattern is always the same. I know what
> the final rendered id value will be and can set the proper
> css/javascript selectors properly ahead of time.
>
> My problem is simply not having total control of the rendered id
> attributes and the verbosity of the rendered values.
>
> "Brock Allen" <> wrote in message
> news: .com...
>
>> The problem is that you don't know what some other control will emit
>> for an ID. I imagine what your problem is is that you want to hard
>> code the ID in your javascript to a well known value. Instead of hard
>> coding, the
>>

> approach
>
>> is to dynamically emit your javascript with the proper ID using the
>>

> Control.ClientID
>
>> property.
>>
>> -Brock
>> DevelopMentor
>> http://staff.develop.com/ballen
>>> Is there a way to prevent the INamingContainer behaviour that
>>> prefixes the id of server controls in master pages with the format
>>> [master page id]_[content id]_. I would prefer to manage the
>>> potential id attribute conflicts myself, rather than having such
>>> verbose id attributes throughout my site.
>>>
>>> Thanks,
>>> ~PJ





Brock Allen
  Reply With Quote
Old 12-22-2005, 09:21 AM   #5
PJ
 
Posts: n/a
Default Re: Override INamingContainer
You're seriously are recommending dynamically generating .js files based on
the prospect that the next version of asp.net might change their rendering
of id attributes?

Insane man...

"Brock Allen" <> wrote in message
news: .com...
> Sure, of course you can make it work. I think what I was trying to say is
> that the pattern is what's documented to potentially change in the future,
> thus the preference to use the ClientID property and merge that
> dynamically into your javascript.
>
> -Brock
> DevelopMentor
> http://staff.develop.com/ballen
>
>> The id is known, one can set the id on the master page, content place
>> holder controls, etc. The pattern is always the same. I know what
>> the final rendered id value will be and can set the proper
>> css/javascript selectors properly ahead of time.
>>
>> My problem is simply not having total control of the rendered id
>> attributes and the verbosity of the rendered values.
>>
>> "Brock Allen" <> wrote in message
>> news: .com...
>>
>>> The problem is that you don't know what some other control will emit
>>> for an ID. I imagine what your problem is is that you want to hard
>>> code the ID in your javascript to a well known value. Instead of hard
>>> coding, the
>>>

>> approach
>>
>>> is to dynamically emit your javascript with the proper ID using the
>>>

>> Control.ClientID
>>
>>> property.
>>>
>>> -Brock
>>> DevelopMentor
>>> http://staff.develop.com/ballen
>>>> Is there a way to prevent the INamingContainer behaviour that
>>>> prefixes the id of server controls in master pages with the format
>>>> [master page id]_[content id]_. I would prefer to manage the
>>>> potential id attribute conflicts myself, rather than having such
>>>> verbose id attributes throughout my site.
>>>>
>>>> Thanks,
>>>> ~PJ

>
>





PJ
  Reply With Quote
Old 12-22-2005, 03:38 PM   #6
Brock Allen
 
Posts: n/a
Default Re: Override INamingContainer
Not insane; I'm simply suggesting the documented way for identifying the
ID of controls in the client. This was the documented was of doing things
in ASP.NET v1.0 and if one had followed those guildlines originally then
one's code would work going forward in v1.1 and v2.0.

-Brock
DevelopMentor
http://staff.develop.com/ballen

> You're seriously are recommending dynamically generating .js files
> based on the prospect that the next version of asp.net might change
> their rendering of id attributes?
>
> Insane man...
>
> "Brock Allen" <> wrote in message
> news: .com...
>
>> Sure, of course you can make it work. I think what I was trying to
>> say is that the pattern is what's documented to potentially change in
>> the future, thus the preference to use the ClientID property and
>> merge that dynamically into your javascript.
>>
>> -Brock
>> DevelopMentor
>> http://staff.develop.com/ballen
>>> The id is known, one can set the id on the master page, content
>>> place holder controls, etc. The pattern is always the same. I know
>>> what the final rendered id value will be and can set the proper
>>> css/javascript selectors properly ahead of time.
>>>
>>> My problem is simply not having total control of the rendered id
>>> attributes and the verbosity of the rendered values.
>>>
>>> "Brock Allen" <> wrote in message
>>> news: .com...
>>>
>>>> The problem is that you don't know what some other control will
>>>> emit for an ID. I imagine what your problem is is that you want to
>>>> hard code the ID in your javascript to a well known value. Instead
>>>> of hard coding, the
>>>>
>>> approach
>>>
>>>> is to dynamically emit your javascript with the proper ID using the
>>>>
>>> Control.ClientID
>>>
>>>> property.
>>>>
>>>> -Brock
>>>> DevelopMentor
>>>> http://staff.develop.com/ballen
>>>>> Is there a way to prevent the INamingContainer behaviour that
>>>>> prefixes the id of server controls in master pages with the format
>>>>> [master page id]_[content id]_. I would prefer to manage the
>>>>> potential id attribute conflicts myself, rather than having such
>>>>> verbose id attributes throughout my site.
>>>>>
>>>>> Thanks,
>>>>> ~PJ





Brock Allen
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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

Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to Override Collector Server Value Zebthakur MCTS 0 12-19-2008 05:52 AM
Any DVD Player that can override User Prohibitions? Walter Traprock DVD Video 3 12-03-2005 11:43 PM




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46