i have a gridview and a textbox
all i wanna do is a searching textbox that on each onkeyup the gridview contents changed
i did this part although
the problem is when the page postback, the focus on textbox lost.
And when i write code in code-behind as textbox.focus(), all the element inside the text are highlightened, and when i type again the text inside textbox disapper.
is there a way to focus on textbox and unhighlightened it?
please help!
sorry for my poor english
aspx
function __doPostBack(eventTarget, eventArgument)
{
document.Form1.__EVENTTARGET.value = eventTarget;
document.Form1.__EVENTARGUMENT.value = eventArgument;
document.Form1.submit();
}
<asp:TextBox ID="txtLike" runat="server" Width="240px"
AutoPostBack="True" onkeyup="javascript:__doPostBack('txtLike','')"
ontextchanged="txtLike_TextChanged"></asp:TextBox>
code-behind
protected void Page_Load(object sender, EventArgs e)
{
if (Request.Form["__EVENTTARGET"] == "txtLike")
{
txtLike_TextChanged(this,new EventArgs());
}
}
protected void txtLike_TextChanged(object sender, EventArgs e)
{
GridView1.DataBind();
}