473,324 Members | 2,257 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,324 software developers and data experts.

ClientID in Repeater gives the Control ID

Hi,

I have never before encountered this problem. I'm trying to retreive the
(unique) ClientID from a TextBox inside an ItemTemplate of a Repeater.
The purpose is to add it to a Button in that same ItemTemplate for
validation purposes.

The ClientID returns the Control's ID, not the generated ID that will be
used in the output HTML.

My page implements the System.Web.UI.INamingContainer interface. My
Control that holds the repeater does also.

I don't get what I am doing wrong.

greetings,
Vincent
Nov 18 '05 #1
2 3995
Vincent,
ClientID will always match the ID until the control is added to the Page
control hierarchy. Before the repeater binds, the controls aren't a part of
the Page's Controls collection yet. Try grabbing the ClientID on code
running in the ItemDataBound event handler. At this point, your control is
bound and exists on the page.

Best regards,
Jeffrey Palermo

"Vincent Mouton"
<vi******************************@marlon.andthenth eextentionbe> wrote in
message news:ek***********************@phobos.telenet-ops.be...
Hi,

I have never before encountered this problem. I'm trying to retreive the
(unique) ClientID from a TextBox inside an ItemTemplate of a Repeater.
The purpose is to add it to a Button in that same ItemTemplate for
validation purposes.

The ClientID returns the Control's ID, not the generated ID that will be
used in the output HTML.

My page implements the System.Web.UI.INamingContainer interface. My
Control that holds the repeater does also.

I don't get what I am doing wrong.

greetings,
Vincent

Nov 18 '05 #2
Jeffrey Palermo [MCP] wrote:
Vincent,
ClientID will always match the ID until the control is added to the Page
control hierarchy. Before the repeater binds, the controls aren't a part of
the Page's Controls collection yet. Try grabbing the ClientID on code
running in the ItemDataBound event handler. At this point, your control is
bound and exists on the page.

Best regards,
Jeffrey Palermo

"Vincent Mouton"
<vi******************************@marlon.andthenth eextentionbe> wrote in
message news:ek***********************@phobos.telenet-ops.be...
Hi,

I have never before encountered this problem. I'm trying to retreive the
(unique) ClientID from a TextBox inside an ItemTemplate of a Repeater.
The purpose is to add it to a Button in that same ItemTemplate for
validation purposes.

The ClientID returns the Control's ID, not the generated ID that will be
used in the output HTML.

My page implements the System.Web.UI.INamingContainer interface. My
Control that holds the repeater does also.

I don't get what I am doing wrong.

greetings,
Vincent


Hi,

Yes indeed. That did it. Thanks a lot. Though I thought that an
ItemCreated event handler was only called after DataBinding, or rather,
while databinding.

Thanks again.

cheers,
v
Nov 18 '05 #3

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

Similar topics

4
by: MattB | last post by:
This is just a rephrased version of a question I posted earlier. I think I'm closer now, so it seemed worthy of a new (more specific) post. In my repeater I'm dynamically creating text boxes, so...
2
by: Henri | last post by:
Sorry to post so many questions but if you could tell me the difference between these 3 IDs, it would help me a lot. I don't know which one to use inside my custom control...
4
by: Roshawn | last post by:
Hi, I have a Repeater control that is databound to an array. This array contains data regarding products (ie. Name, Price, Manufacturer, etc.). I am wondering how do I display data in a...
1
by: Bennett Haselton | last post by:
If I have this code for repeater, it gives a compilation error saying "The type or namespace name 'MyValue2' could not be found": <asp:Repeater id="MyList" runat="server"> <ItemTemplate>...
4
by: huzz | last post by:
I am trying to access a DropDownList control inside a repeater using ItemCommand as shown below but for some reason i can't access the DropDownList. When i step through the debug i get <undefine...
0
by: Iain | last post by:
A placeholder a repeater and a couple of textboxes walk into a bar....haha... No, Seriously, I have a placeholder, a repeater, the repeater itemtemplate has a textbox in it, and a submit button...
4
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString;...
2
by: koonda | last post by:
Hi all, Currently I am doing a project in ASP.NET using C#. I posted this message before but that was a different approach. Now I want to implement it this way. I have a Database in SQL Server...
2
by: AC [MVP MOSS] | last post by:
I have a repeater with a header, footer, and item template. The item template is the only one with server controls (hyperlinks, labels, and a nested repeater). Within the top repeater, I'm handling...
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: 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: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.