Textbox Focus Problem
-
Hi, Am having textbox in Gridview.I need to set the focus(i.e. the cursor should place inside textbox) when add link button is clicked. For this i have used java scipt. function Click_Enter(CID,event) { var key; key=(event.which) ? event.which : event.keyCode; if(key==13) { document.getElementById(CID).focus(); } return true; } And in code behind of link button click event ImageButton ibtnSave = (ImageButton)gvBillingType.FooterRow.FindControl("ibtnSave"); TextBox txtAddcontrol = (TextBox)gvBillingType.FooterRow.FindControl("txtFooterBillingType"); Page.RegisterStartupScript("SetFocus", "document.getElementById('" + txtAddcontrol.ClientID + "').focus();"); txtAddcontrol.Attributes.Add("onkeydown", "javascript : return Click_Enter('" + ibtnSave.ClientID + "',event);"); this code is Wkg in Mozila.. but in IE it is not WKG.. Pls anyone help me fast.
-
Hi, Am having textbox in Gridview.I need to set the focus(i.e. the cursor should place inside textbox) when add link button is clicked. For this i have used java scipt. function Click_Enter(CID,event) { var key; key=(event.which) ? event.which : event.keyCode; if(key==13) { document.getElementById(CID).focus(); } return true; } And in code behind of link button click event ImageButton ibtnSave = (ImageButton)gvBillingType.FooterRow.FindControl("ibtnSave"); TextBox txtAddcontrol = (TextBox)gvBillingType.FooterRow.FindControl("txtFooterBillingType"); Page.RegisterStartupScript("SetFocus", "document.getElementById('" + txtAddcontrol.ClientID + "').focus();"); txtAddcontrol.Attributes.Add("onkeydown", "javascript : return Click_Enter('" + ibtnSave.ClientID + "',event);"); this code is Wkg in Mozila.. but in IE it is not WKG.. Pls anyone help me fast.
-
Hi, Am having textbox in Gridview.I need to set the focus(i.e. the cursor should place inside textbox) when add link button is clicked. For this i have used java scipt. function Click_Enter(CID,event) { var key; key=(event.which) ? event.which : event.keyCode; if(key==13) { document.getElementById(CID).focus(); } return true; } And in code behind of link button click event ImageButton ibtnSave = (ImageButton)gvBillingType.FooterRow.FindControl("ibtnSave"); TextBox txtAddcontrol = (TextBox)gvBillingType.FooterRow.FindControl("txtFooterBillingType"); Page.RegisterStartupScript("SetFocus", "document.getElementById('" + txtAddcontrol.ClientID + "').focus();"); txtAddcontrol.Attributes.Add("onkeydown", "javascript : return Click_Enter('" + ibtnSave.ClientID + "',event);"); this code is Wkg in Mozila.. but in IE it is not WKG.. Pls anyone help me fast.
I don't think problem with browser but ur code checks KeyCode and which won't work if u use mouse to click.
-
I don't think problem with browser but ur code checks KeyCode and which won't work if u use mouse to click.
Then what is the solution for this problem.. I have tried hardly for this.. The cursor alone is not placing inside textbox.. But all the other work like after entering any text and press enter it is getting save in gridview... This problem is occuring only in IE
-
Then what is the solution for this problem.. I have tried hardly for this.. The cursor alone is not placing inside textbox.. But all the other work like after entering any text and press enter it is getting save in gridview... This problem is occuring only in IE
txtAddcontrol.Attributes.Add("onkeypress", "javascript : return Click_Enter('" + ibtnSave.ClientID + "',event);"); try this...Hope it should be KeyPress event....
CodingRocks ASP.NET,C#.NET Programmer BANGALORE "Winners don't do different things. They do things differently. ...
-
txtAddcontrol.Attributes.Add("onkeypress", "javascript : return Click_Enter('" + ibtnSave.ClientID + "',event);"); try this...Hope it should be KeyPress event....
CodingRocks ASP.NET,C#.NET Programmer BANGALORE "Winners don't do different things. They do things differently. ...
Hi... I tried but it is not wkg