Assuming you are using a HTML hidden textbox and a HTML button here is on
way to do it.
set the id and name of the textbox to tbxHidden
add the attribute runat="server" to tbxHidden
set the id and name of the button to btnMyButton
add the attribute runat="server" to btnMyButton
save
double click the webform (this will create object references in the code)
add this line to page_load
btnMyButton.Attributes.Add("OnClick",
"javascript
:myButtonClick(document.all." + tbxHidden.ClientID + ")");
javascript can look loke this
function myButtonClick(hiddenTextBox){
alert(hiddenTextBox.value);
}
if this need to run outside of IE make sure you set ID and Name also change
document.all to document.forms(0)
Hope this helps
Jamey...
"dotbet beginner" <sk*****@comsult.com> wrote in message
news:10****************************@phx.gbl...
I have a hidden field and a usercontrol in a webform. And
I have a button in the user control. When I click this
button I want to access the value of the hidden field on
the form by means of a client-side javascript function.
Any help is appreciated.
Thanks,
Sudhir.