474,044 Members | 7,264 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trying to find ClientID of web form - Update

This works:

<form>
<asp:TextBox id="name" />
<%= name.ClientID %>
</form>

But this DOES NOT work:

<form>
<datagrid id="dg">
<asp:TextBox id="name" />
<%= name.ClientID %>
</datagrid>
</form>

and throws an error of:
Compilation Error
Compiler Error Message: BC30451: Name 'name' is not declared.

Any ida why???

TIA
....Geshel
--
*************** *************** *************** *************** **********
My reply-to is an automatically monitored spam honeypot. Do not use it
unless you want to be blacklisted by SpamCop. Please reply to my first
name at my last name dot org.
*************** *************** *************** *************** **********
Nov 21 '05
19 1638
"Juan T. Llibre" <no***********@ nowhere.com> wrote in news:#yj3IePdFH A.3616
@TK2MSFTNGP09.p hx.gbl:
Perhaps I got a little rough with him


You sure did, and undeservedly, I'll add.

re:
I'm not an idiot


You sure acted like one.


I have an idea.

The rest of us dont care who called who what - Can we just stop it please? These are technical
groups. If you guys really want to duke it out, Im sure email would suffice or some other
newsgroup.


--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Make your ASP.NET applications run faster
http://www.atozed.com/IntraWeb/
Nov 21 '05 #11

Perhaps a sense of what's fair should enter into
technical discussions on occasion, Chad.

If you know me, you know that I *never* enter into
discussions other than technical ones, but this was
just not the way to be greeted on a fine Sunday morning.

I didn't deserve that. Period.

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Chad Z. Hower aka Kudzu" <cp**@hower.org > wrote in message
news:Xn******** *************** ***@127.0.0.1.. .
I have an idea.

The rest of us dont care who called who what - Can we just stop it please? These are
technical
groups. If you guys really want to duke it out, Im sure email would suffice or some
other
newsgroup.

Nov 21 '05 #12
Juan,

I did not like it at all what you wrote in your message before this one.
However I think that it is better to follow the advice from Kudzu.

(When you want to know what I did not like. You are in my opinion feeding in
that an anti MVP behaviour. There is in my opinion no need for that).

Cor
Nov 21 '05 #13
I'm going to post my last comment on this thread.

re:
(When you want to know what I did not like. You are in my opinion feeding in that an
anti MVP behaviour. There is in my opinion no need for that).
Cor,

Look at his very first post to this thread :

---000---
"About 25+ web sites I visited recommend..."

"why did the other 25+ MVP's (who recommended this method)
also get it wrong?"

As a hint, here are a few URL's where it gives the exact method that
fails for me:
http://www.syncfusion.com/FAQ/aspnet/WEB_c5c.aspx (#28.10, link doesn't
work)
http://www.startvbdotnet.com/aspsite...s/default.aspx
http://www.thecodeproject.com/aspnet...in_asp_net.asp
http://youngpup.net/2004/distro (second scrollbox)
http://www.ondotnet.com/pub/a/dotnet...t&x-order=date
---000---

That is, clearly, an attempt to smear MVPs by
claiming that the advice we give is "wrong".

Now, check to see exactly how many of the sites he posted
links to are run by MVPs. I'll save you the trouble : exactly none!

His response to that ? "Okay, so I exaggerate a little."

Then, his next comment is : "As an MVP, you should have known this.",
trying -again- to smear MVPs in the worst possible way by implying
that I, an MVP, should have known about code problems in code that
he had not posted yet.

Then, he erupts with : "I hope you don't mind putting
your big mouth where your (probably even bigger) ego"

To finalize, he spits this : "I might not be an MVP,
but that's no reason to treat me like a simpleton."

Those quotes reveal a tendency to smear MVPs, and while I've seen
comments like those come and go, these were the last straw for me.

Cor, *nobody* has treated him like a simpleton. I certainly didn't.

I offered an explanation. If he felt it was too simple an explanation,
pointing that out would have sufficed, without the need to repeatedly
smear neither me nor my fellow MVPs.

So, that's it. This is my last comment.

I'm off to try to mend my nice summer sunday.
It's such a beautiful sunny day, too !


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Cor Ligthert" <no************ @planet.nl> wrote in message
news:uq******** ******@TK2MSFTN GP15.phx.gbl... Juan,

I did not like it at all what you wrote in your message before this one. However I think
that it is better to follow the advice from Kudzu.

(When you want to know what I did not like. You are in my opinion feeding in that an
anti MVP behaviour. There is in my opinion no need for that).

Cor

Nov 21 '05 #14
Neo,

Juan does not know you. He tried to help you. I really don't know what that
has to do with that he is awarded as MVP or the way you find that he threats
you.

You need an answer and in the way you write now, you will probably never get
it from a newsgroup.

This is the last time I give you this advice any reply on this will not be
answered by me.

Cor
Nov 21 '05 #15
Juan T. Llibre wrote:
re:
I might not be an MVP


Please keep that out of this discussion.

You already started this thread by claiming that you had
checked "25+ MVP sites" when -actually- *none* of the
sites you linked to are MVP sites.

So, this is the *second* time in this thread that you are unfair to MVPs.

You have some sort of "MVPness envy" and lashed out angrily
at me imagining an attitude that only exists in your mind as a
way to compensate for your having a hard time with some code.


Fine. Allow me to amend that sentence to, "I might not be *at the skill
level of* an MVP..."

I have nothing against MVP's. My first mention was that I had gone to
many, many sites, a number of whom had articles from MVP's. Probably a
badly worded statement, mea culpa. The second mention was to point out
that I am not close your skill level yet, but I'm also nowhere near a
beginner's level. I know the basics well enough.

I would also like to make a partial apology. While I don't believe I
overreacted, I do believe that my reply was a bit too much of a personal
attack. To use a metaphor, I lunged when I should have parried. For
that, I apologise about the "big mouth" and "ego" statements.

....Geshel
--
*************** *************** *************** *************** **********
My reply-to is an automatically monitored spam honeypot. Do not use it
unless you want to be blacklisted by SpamCop. Please reply to my first
name at my last name dot org.
*************** *************** *************** *************** **********
Nov 21 '05 #16
"Cor Ligthert" <no************ @planet.nl> wrote in
news:uW******** ******@TK2MSFTN GP09.phx.gbl:
Juan does not know you. He tried to help you. I really don't know what
that has to do with that he is awarded as MVP or the way you find that
he threats you.

You need an answer and in the way you write now, you will probably
never get it from a newsgroup.

This is the last time I give you this advice any reply on this will
not be answered by me.


I dont think I posted this to this thread yet, if I did I apologize for the duplication. But I feel its very
appropriate:

http://www.hower.org/kudzu/dotnet/ne...guidelines.iwp
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programmin g is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 21 '05 #17
re:
I do believe that my reply was a bit too much of a personal attack. To use a metaphor, I
lunged when I should have parried. For that, I apologise about the "big mouth" and "ego"
statements.
Apology accepted.

It takes a good man to recognize a mistake and amend it.

I hope that others don't continue to post to this thread,
and that it dies peacefully, except for a possible answer
to your code problem.

Now, I'm *really* off to enjoy the last of today's sunshine.

;-)


Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Español
Ven, y hablemos de ASP.NET...
=============== =======

"Neo Geshel" <go****@geshel. org> wrote in message
news:Op******** ******@TK2MSFTN GP09.phx.gbl... Juan T. Llibre wrote:
re:
I might not be an MVP


Please keep that out of this discussion.

You already started this thread by claiming that you had
checked "25+ MVP sites" when -actually- *none* of the
sites you linked to are MVP sites.

So, this is the *second* time in this thread that you are unfair to MVPs.

You have some sort of "MVPness envy" and lashed out angrily
at me imagining an attitude that only exists in your mind as a
way to compensate for your having a hard time with some code.


Fine. Allow me to amend that sentence to, "I might not be *at the skill level of* an
MVP..."

I have nothing against MVP's. My first mention was that I had gone to many, many sites,
a number of whom had articles from MVP's. Probably a badly worded statement, mea culpa.
The second mention was to point out that I am not close your skill level yet, but I'm
also nowhere near a beginner's level. I know the basics well enough.

I would also like to make a partial apology. While I don't believe I overreacted, I do
believe that my reply was a bit too much of a personal attack. To use a metaphor, I
lunged when I should have parried. For that, I apologise about the "big mouth" and "ego"
statements.

...Geshel

Nov 21 '05 #18
The code, <%= name.ClientID %>, won't work since TextBox.name is a child of a
some DataGrid child. It will not have the "name" id but the "ClientID".
However, I tried he following:

....
<%= (dg.FindControl ("name") as TextBox).Client ID %>
....

This compiled and ran successfully. However, the ClientID did not appear in
the TextBox!

George

"Neo Geshel" wrote:
Juan T. Llibre wrote:
This works fine :

<form runat="server">
<datagrid id="dg">
<asp:TextBox id="name" Runat="Server" />
<%=name.ClientI D %>
</datagrid>
</form>

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espa�ol
Ven, y hablemos de ASP.NET...
=============== =======

Unfortunately, not for me. It throws that error, and I don't know why.
Any clues?

...Geshel
--
*************** *************** *************** *************** **********
My reply-to is an automatically monitored spam honeypot. Do not use it
unless you want to be blacklisted by SpamCop. Please reply to my first
name at my last name dot org.
*************** *************** *************** *************** **********

Nov 21 '05 #19
Perhaps, you can not get the ClientID inside of the DataGrid! I was able to
get the ClientiD after the DataGrid code but not inside of the the DataGrid
with the code:

<form id="Form1" method="post" runat="server">
<asp:DataGrid id=DataGrid1 style="Z-INDEX: 101; LEFT: 80px; POSITION:
absolute; TOP: 80px" runat="server" DataSource="<%# dataSet11 %>"
DataMember="use rs" AutoGenerateCol umns="False">
<Columns>
<asp:BoundColum n DataField="name " SortExpression= "name"
HeaderText="Nam e"></asp:BoundColumn >
<asp:TemplateCo lumn HeaderText="Cli entId">
<ItemTemplate >
<asp:TextBox id="TextBox1" runat="server"> <%=
(DataGrid1.Item s[0].FindControl("T extBox1") as TextBox).Client ID
%></asp:TextBox>
</ItemTemplate>
</asp:TemplateCol umn>
</Columns>
</asp:DataGrid>
</form>
<div><%= (DataGrid1.Item s[0].FindControl("T extBox1") as TextBox).Client ID
%></div>

"George Jackson" wrote:
The code, <%= name.ClientID %>, won't work since TextBox.name is a child of a
some DataGrid child. It will not have the "name" id but the "ClientID".
However, I tried he following:

...
<%= (dg.FindControl ("name") as TextBox).Client ID %>
...

This compiled and ran successfully. However, the ClientID did not appear in
the TextBox!

George

"Neo Geshel" wrote:
Juan T. Llibre wrote:
This works fine :

<form runat="server">
<datagrid id="dg">
<asp:TextBox id="name" Runat="Server" />
<%=name.ClientI D %>
</datagrid>
</form>

Juan T. Llibre
ASP.NET MVP
http://asp.net.do/foros/
Foros de ASP.NET en Espa�ol
Ven, y hablemos de ASP.NET...
=============== =======

Unfortunately, not for me. It throws that error, and I don't know why.
Any clues?

...Geshel
--
*************** *************** *************** *************** **********
My reply-to is an automatically monitored spam honeypot. Do not use it
unless you want to be blacklisted by SpamCop. Please reply to my first
name at my last name dot org.
*************** *************** *************** *************** **********

Nov 21 '05 #20

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

Similar topics

2
2411
by: Neo Geshel | last post by:
I need to get the ClientID of a form field for some JavaScript. About 25+ web sites I visited recommend the following method for finding the client ID of a web form: Web Form -> <asp:TextBox ID="datefield" type="hidden" Runat="Server" /> Client ID -> <%= datefield.ClientID() %> Unfortunately, this only provides the following error: Compilation Error
25
4096
by: Neo Geshel | last post by:
This works: <form> <asp:TextBox id="name" /> <%= name.ClientID %> </form> But this DOES NOT work: <form>
2
1525
by: Neo Geshel | last post by:
After pouring over about a dozen sites that clearly dealt with ClientID all by itself, I came to the realization that about 2/3+ of them were doing it wrong. It is indeed impossible to grab the Client ID of a form field from within a DataGrid like this: <%= FormFieldID.ClientID %>. At least, not without extra work. How did I do this? I created a new DataGrid from scratch, with a form above it and a form inside of it. This was a page...
0
10337
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
12140
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11602
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
12023
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 most users, this new feature is actually very convenient. If you want to control the update process,...
0
11141
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
8698
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6837
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
5416
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4944
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.