Please do some changes
1. Class name and property name can't be same.
2. Your property should be exist in code behind page of that page where javascript defined.
For example :
Code behind page is
using System;
namespace UserInterface
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
LockValue = "Sandeep";
}
public static string LockValue { get; set; }
}
}
and your .aspx page where on button click calling property value
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="UserInterface.WebForm1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function Submit()
{
var lock = '<%= LockValue %>';
alert(lock);
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="btnTest" runat="server" Text="Test" OnClientClick="Submit()" />
</div>
</form>
</body>
</html>