Hi,
we can not access values changed by javascript in server side.
To overcome this you can use session variables to store required data.by this we no need to use database.
First we've to pass the changed data to server in asynchronous manner.
For better understanding 'm providing some example here..
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script language="javascript" >
function setval() {
$("#TextBox1").text("hi this is testing");
$.post("default3.aspx?action=change", {txt:"hi this is testing"}, function (data) { });
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type ="button" value ="set Value" id="bthsetval" onclick="setval()" />
<asp:textbox id="TextBox1" runat="server" xmlns:asp="#unknown"></asp:textbox>><br />
<asp:button id="Button1" runat="server" text="Button" onclick="Button1_Click" xmlns:asp="#unknown" />
</div>
</form>
</body>
</html>
In back you've to write some code for storing data in session variable
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["action"] != null)
{
Session["lbltext"] = Request.Form["txt"].ToString();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
if (Session["lbltext"].ToString() != "")
{
TextBox1.Text = Session["lbltext"].ToString();
}
}
In this example I used jquery for posting data to server.Intead of that you can use basix asynchronous request for sending data to server.
I hope you understand what i said.
All the best