I have a user control with some RadTextboxes, RadNumericTextboxes, RadComboBoxes. I have this usercontrol on an aspx page which has the RadAjaxManager. I have a requirement to maintain if the controls in the usercontrol have changes, so, I have set the AutoPostBack property to true and on postback, I set ViewState["NameIsDirty"]=true; But my problem is, when the user updates the Name and clicks on tab, the cursor goes to the next control and immediately disappears! Seems like it is getting focussed on the first control on the page. If I dont have the AutoPostBack property set to true, the focus is on the next control and everything is fine. How do I make the focus stay on the control on which it is supposed to be. I searched the forums and tried a few solutions, but they did not work.
I have tried this and it doesnt work:
I have tried this and it doesnt work:
protected void rdtCCno_TextChanged(object sender, EventArgs e)
{
ViewState["NumberIsDirty"] = true;
string script =string.Format(@"window.setTimeOut(function(){{$find('{0}').Focus();}},10);",rdtCvv2.ClientID);
ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "mykey", script,true);
}
protected void rdcExpMonth_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
{
ViewState["ExpMonthIsDirty"] = true;
var rdAjaxManager = RadAjaxManager.GetCurrent(this.Page);
if (rdAjaxManager != null)
{
rdAjaxManager.FocusControl(rdtAddr1);
}
}