For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > January 2007 > ajax and asp.net in user control









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author ajax and asp.net in user control
olivier

2007-01-31, 7:13 pm

Hi,

I want to use javascript (ajax) in User Control but to call
the object is difficult.

If my user control is called MyControl.
To use the object in javascript, i make,

Ex:
document.GetElementId("MyControl_textbox").value

Have you an idea to get the name of the user control asp.net
to instance my code javascript cause the same code javascript must to work
in other User control.

Thank's
Olivier
ps : excuse me for my poor english.

Mark Rae

2007-01-31, 7:13 pm

"olivier" <nospam@free.fr> wrote in message
news:ea9PDJWRHHA.1036@TK2MSFTNGP03.phx.gbl...

> document.GetElementId("MyControl_textbox").value

document.GetElementId('<%=MyControl_textbox.ClientID%>').value;

> ps : excuse me for my poor english.

Pas de quoi...:-)


olivier

2007-01-31, 7:13 pm

Thank's

I had not thought of it

But it's more portable if i write

document.GetElementId('<%=Page.Findcontrol("MyTextBox").ClientID%>').value;

What do you think ?

Olivier
"Mark Rae" <mark@markNOSPAMrae.com> a écrit dans le message de news: %23gFFNTWRHHA.4404@TK2MSFTNGP03.phx.gbl...
"olivier" <nospam@free.fr> wrote in message
news:ea9PDJWRHHA.1036@TK2MSFTNGP03.phx.gbl...

> document.GetElementId("MyControl_textbox").value

document.GetElementId('<%=MyControl_textbox.ClientID%>').value;

> ps : excuse me for my poor english.

Pas de quoi...:-)



Mark Rae

2007-01-31, 7:13 pm

"olivier" <nospam@free.fr> wrote in message
news:%23%23N4GnWRHHA.1908@TK2MSFTNGP05.phx.gbl...

>But it's more portable if i write
>
>document.GetElementId('<%=Page.Findcontrol("MyTextBox").ClientID%>').value;
>
>What do you think ?


I don't think it will make much difference...

However, something that I missed in my previous reply and which I've just
spotted now is that it's getElementById, not getElementId


Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com