I'm not certain I understand what you're asking, but I'll take a guess. You
need the client ID an html element that asp.net generates, correct? There
is a .ClientID property that will expose that. So, you have to pull that
client ID from your code behind and inject it into your client-side code in
someway. You can build strings in your codebehind containing javascript
functions, but I personally find this to be a PITA. So, I use a Literal
that's hidden and put my client-side code in there, alter it as needed, and
then register the text of it. This makes for a better Visual Studio
experience. Here's a sample:
codebehind:
protected void Page_Load(objec t sender, EventArgs e)
{
litClientScript .Text = litClientScript .Text.Replace(" %someTextBox%",
someTextBox.Cli entID);
Page.RegisterCl ientScriptBlock ("JS", litClientScript .Text);
}
..aspx:
<asp:textbox id="someTextBox " runat="server" text="here's some text" />
<input type="button" onclick="giveIt ();" value="Click me" />
<asp:literal id="litClientSc ript" runat="server" visible="false" >
<script type="text/javascript">
function giveIt() {
alert(document. getElementById( '%someTextBox%' ).value);
}
</script>
</asp:literal>
Ray at work
"Harvey Triana" <ha**********@h otmail.comwrote in message
news:Oz******** *****@TK2MSFTNG P03.phx.gbl...
Hi--
Sample. When i write something like:
<input type="button" name="btnSend" value="Send"
onclick="callSo meTask(getEleme ntById('myContr ol').value );return false;
/>
I can run some cliente code if "myControl" is an Asp Textbox;
getElementById( 'myControl').va lue get current Text of Textbox
If i write a Web User Control, i dont know how to implemente the property
"value", value runs for the cliente not in server.
Thanks,
<Harvey Triana />