@avinash sh
This is all doable client side.
There's no need to make an expensive server side call.
All you have to do is retrieve the text from TextBox1 and display it above TextBox2 (I think you meant this) when the mouse hovers over it right?
Place a Label above your TextBox2 that will be used to display the text.
Labels are rendered as <span>s. Write JavaScript that will retrieve the text from TextBox1 and place that in the inner html of the label (the <span>).
Here's pure HTML/javascript
:
-
<html>
-
<head>
-
<script type="text/javascript">
-
function mouseOver()
-
{
-
var theText = document.getElementById("myTextBox1").value;
-
document.getElementById("myLabel").innerHTML = theText;
-
-
}
-
function mouseOut()
-
{
-
document.getElementById("myLabel").innerHTML = "";
-
}
-
</script>
-
</head>
-
-
<body>
-
<input type="text" value="some text in my text box 1" id="myTextBox1" />
-
<br />
-
<br />
-
<br />
-
<span id="myLabel"></span><br />
-
<input type="text" value="" id="myTextBox2" onmouseover="mouseOver();" onmouseout="mouseOut();"/>
-
-
-
</body>
-
</html>
-
If this were ASP.NET code you'd have to retrieve the ClientID of the TextBox1 control and the ClientID of the Label control. To do this you can use ASP to write the value directly into the script:
-
<html>
-
<head>
-
<script type="text/javascript">
-
function mouseOver()
-
{
-
var theText = document.getElementById("<%=myTextBox1.ClientID%>").value;
-
document.getElementById("<%=myLabel.ClientID%>").innerHTML = theText;
-
-
}
-
function mouseOut()
-
{
-
document.getElementById("<%=myLabel.ClientID%>").innerHTML = "";
-
}
-
</script>
-
</head>
-
-
<body>
-
<asp:TextBox ID="myTextBox1" runat="server" />
-
<br />
-
<br />
-
<br />
-
<asp:Label id="myLabel" runat="server"></asp:Label><br />
-
<asp:TextBox ID="myTextBox2" runat="server" onmouseover="mouseOver();" onmouseout="mouseOut();" />
-
-
-
</body>
-
</html>
-
If you wanted to execute server side code for some reason during the mouse over event, then you would have to implement an Ajax Call to a method on the server. You'll have to learn how to use Ajax to do this.