Hi sameesultani7...,
Specify BODY as the parent element. Refer below article for details.
Refer below example.
Script File
$(function () {
$('body').on('change', '[id*=txtProductCode]', function () {
alert($(this).val());
});
});
HTML
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css" />
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script src="dashboard.js"></script>
<asp:ScriptManager runat="server" />
<asp:UpdatePanel runat="server">
<ContentTemplate>
<div class="container">
<div class="row">
<div class="col-md-6">
<asp:TextBox ID="txtProductCode" runat="server" CssClass="form-control"></asp:TextBox>
<br />
</div>
<div class="col-md-6">
<asp:Button Text="Submit" runat="server" CssClass="btn btn-primary" OnClick="OnSubmit" />
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
Code
C#
protected void OnSubmit(object sender, EventArgs e)
{
ScriptManager.RegisterStartupScript((sender as Control), this.GetType(), "alert", "alert('" + txtProductCode.Text.Trim() + "');", true);
}
VB.Net
Protected Sub OnSubmit(ByVal sender As Object, ByVal e As EventArgs)
ScriptManager.RegisterStartupScript(TryCast(sender, Control), Me.GetType(), "alert", "alert('" & txtProductCode.Text.Trim() & "');", True)
End Sub
Screenshot