473,327 Members | 2,090 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,327 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 895
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...
2
by: kal | last post by:
I have registered my custom control in web.config as follows: <add tagPrefix="PhoenixControls" namespace="PhoenixControls" assembly="PhoenixControls"/> I have added a file called...
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: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.