473,397 Members | 1,974 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Custom control is naming it's components differently

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
nj********@hotmail.com
http://www.nathansokalski.com/
Jan 4 '07 #1
3 1033
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" <nj********@hotmail.comwrote in message
news:ev*************@TK2MSFTNGP06.phx.gbl...
>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
nj********@hotmail.com
http://www.nathansokalski.com/

Jan 4 '07 #2
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
nj********@hotmail.com
http://www.nathansokalski.com/

"Riki" <ri**@bounce.comwrote in message
news:O1****************@TK2MSFTNGP02.phx.gbl...
>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" <nj********@hotmail.comwrote in message
news:ev*************@TK2MSFTNGP06.phx.gbl...
>>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
nj********@hotmail.com
http://www.nathansokalski.com/


Jan 4 '07 #3
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
Jan 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: SammyBar | last post by:
Hi, I'm trying to bind a custom collection class to a data grid, following the guidelines from the article http://msdn.microsoft.com/msdnmag/issues/05/08/CollectionsandDataBinding/default.aspx....
11
by: Sagaert Johan | last post by:
I have made a custom control that draws a rectangle when the mouse is down, and does nothing when the mouse is up. I set/reset a flag in MouseDown/Mouse up and use this to do the drawing in the...
7
by: Shimon Sim | last post by:
I have a custom composite control I have following property
5
by: ross kerr | last post by:
Hi All, I am extending the combobox to create a control that selects an item based on the text the user is typing into the text area of the control. I have an issue that occurs only when i...
1
by: Brian Henry | last post by:
I am trying to make a custom user control that gets a list of users from our database and populates the list, its an owner drawn control also, the problem is, I placed the item onto a form and...
19
by: Jamey Shuemaker | last post by:
I'm in the process of expanding my knowledge and use of Class Modules. I've perused MSDN and this and other sites, and I'm pretty comfortable with my understanding of Class Modules with the...
2
by: J R M | last post by:
I've developed a custom control (it's basically a drop-down list and then a couple of textboxes to include meta-data for the selection) that I'm embedding into another custom control (the idea is...
3
by: Nathan Sokalski | last post by:
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...
0
by: ChopStickr | last post by:
I have a custom control that is embedded (using the object tag) in an html document. The control takes a path to a local client ini file. Reads the file. Executes the program specified in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.