i want to change the label value same as textbox while i entering a character. so here got a question?How can i maintain the textbox cursor after the postback ?For example i type 'ab'. The textbox cursor position will remain at the last character which is 'b'
Here is my coding
<script language="javascript" type="text/javascript">
function RefreshUpdatePanel() {
__doPostBack('<%= TextBox1.ClientID %>', '');
};
</script>
<asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<br />
<br />
<asp:TextBox ID="TextBox1" runat="server" onkeyup="RefreshUpdatePanel();"
ontextchanged="TextBox1_TextChanged"></asp:TextBox>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="TextBox1" />
</Triggers>
</asp:UpdatePanel>
</ContentTemplate>
</asp:UpdatePanel>
my back end code
protected void Page_Load(object sender, EventArgs e)
{
//--If post back is txtSearach , then do search function--
if (Page.Request.Form["__EVENTTARGET"] == TextBox1.ClientID)
{
this.Label1.Text = this.TextBox1.Text;
}
}
I also try put textbox1.focus() while the postback event, but the textbox cursor posittion will start at the first character :(