Assume TextBox ID="txtName"
First, there are the simple examples of a standard aspx page:
Here is the complex sample used for accessing a MasterPage's updatePanel for example:
<script type="text/javascript" languague="javascript">
function simple1() {
var txtVal = $get('<%= txtName.ClientID %>').value;
}
function simple2() {
var txtVal = $document.getElementById('<%= txtName.ClientID %>').value;
}
</script>
// In the ASPX class
private string scriptKey = "alertName";
private string script = "function alertName() { var txt = document.getElementById('[txtNameID]'); alert(txt.value); }";
// In the Page_Load event
script = script.Replace("[txtNameID]", txtName.ClientID);
ClientScript.RegisterClientScriptBlock(this.Page.GetType(), scriptKey, script, true);
references: http://www.velocityreviews.com/forums/t109803-callback-manager-masterpage.html
No comments:
Post a Comment