Home > Code > Javascript > Get Asp.Net Content page textbox value using Java script

Get Asp.Net Content page textbox value using Java script

by Thamil   on Nov 14, 2010   Category: Javascript   |  Views: 1826    |  Points: 25   |  Gold 


<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Javascript/Site1.Master"
CodeBehind="samples.aspx.cs" Inherits="TestWeb.Javascript.samples" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input id="bntGetVal" type="button" value="Get TextBox Value" onclick="GetValue()" />
<script type="text/javascript">

function GetValue()
{
var textbox = document.getElementById("<%=TextBox1.ClientID%>");
alert("hi " + textbox.value);
}
</script>
</div>
</asp:Content>





Post Code  |  Code Snippet Home

Recent Posts

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts