473,569 Members | 2,872 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.I NamingContainer 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 4017
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.andt hentheextention be> 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.I NamingContainer 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.andt hentheextention be> 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.I NamingContainer 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
4130
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 at compile time I don't know what text boxes are going to be present at run time. This is where it seems the FindControl method would be come into...
2
6487
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
2366
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 control that is contained in the Repeater's ItemTemplate? Here's my example code: Sub BindToArray()
1
2561
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> <%#Container.DataItem%><br> <% MyValue2.Text = "ghi"; %> <asp:TextBox ID="MyValue2" Runat="server"/> <br> </ItemTemplate>
4
34511
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 value> for the DropDownList What am i doing wrong? <asp:Repeater ID="Repeater1" Runat="server" OnItemDataBound="create_ddl"...
0
1289
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 to tie it all together. So, in the page_load event I bind to a simple array using: rep.DataSource = new string; rep.DataBind();
4
4896
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; //open connection SqlConnection m_conn = new SqlConnection("Server=server; Database=database; UId=username; Pwd=password");
2
2378
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 containing 5 tables. I have 5 Listbox Controls which I have populated from the 5 underlying tables. What I want to do is to bind the 5 Listbox...
2
2636
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 the ItemDataBound method in the code behind. In this handler, I need to get access to the controls within the ItemTemplate.... however I've only...
0
7619
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7930
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7681
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7983
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6290
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5514
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3662
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
950
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.