Showing posts with label focus. Show all posts
Showing posts with label focus. Show all posts

Wednesday, March 28, 2012

modal popup error - cant set focus to control

Hi

My webpage contains a modal popup. I am using the atlas release - the june ctp i think

I'm getting an error on my webpage if I view it in Internet Explorer 6. This is the error

Can't move focus to the control because it's invisible not enabled or of a type that does not accept focus

I get this error on page load. Everything works fine but naturally i dont like the error message.

I would really appreciate it if you could take a look and shed some light on it for me

http://84.92.22.217/UChoose/frames.aspx

thanks a lot

andrea

I checked your website and did not see any error message. Everything works fine.
No issues here with IE6 or Firefox 1.5.0.8.

Modal Popup Extender - Setting Focus

Hi,

I have HostModalPopup.aspx webform with a ShowModalWindow button (When clicked shows a Modal Popup Window) and there are some text boxes after the button.

The Modal Pop Up window has 3 controls: a text box field, a submit button and a close button.

1) When the Modal Popup window is shown, I would like to be able to setfocus to the textbox. I thought I should be able to do this with document.getElementById('TextBox1').focus() on some event that gets triggered when the modal popup window is made visible, but I could not find any such DHTML event.

2) The taborder/tabindex of the controls in HostModalPopup.aspx, once the ShowModalWindow is opened and closed, no longer works. If I set the focus to one of the textboxes and hit tab the cursor goes to address bar instead of going to a textbox with next tabindex. I am using AJAX Control Kit verion 1.0.10606.0

Any help is greatly appreciated.

- Surya

Use ScriptManager1.SetFocus(TextBox1)


http://www.asp.net/AJAX/Documentation/Live/mref/O_T_System_Web_UI_ScriptManager_SetFocus.aspx

http://msdn2.microsoft.com/en-us/e04ah0f4


Thank you guys!

The ScriptManager.SetFocus did it for the first issue.

-Surya

Modal Popup Extender and set focus

I want to set focus on a textbox inside the modal popup extender when it is made visible and I cant for the life of me find an appropriate way to do this!

The popupcontrol is not good because when I add the attribute onclick it gets run before the textbox is made visible!

Any clues?

Cheers

Ross

Sorry, I hate to bump this but could really do with knowing how this can be done.

Ross


You can try registering a clientside startup script that sets focus to the text box. Or you can use the clientside script to open the modal popup and then set the focus.

#1:

page.ClientScript.RegisterStartupScript(me.getType(), "setfocus", "<script language=""javascript"">$get('textbox1').focus();</script>")

#2:

<script language="javascript">

function openModal(){

$find('modalpopupextender1').show();

$get('textbox1').focus();

}

</script>

The ids of the mpe and the textbox will need to be the client rendered id, so if you are using a masterpage or if this is in a user control, you will need to get the clientid from the server or from the output of the page prior to implimenting the code.

Let me know if need anyhting else.

-Alan


the solution in this article worked for me (although i would like to see something much better)

http://www.aspdotnetcodes.com/ModalPopup_Postback.aspx

then you add something similar to the following in the Page_Load event:

btn.Attributes.Add("onclick","fnSetFocus('" + control.ClientID +"');");


hi

go to the following link

http://forums.asp.net/t/1103365.aspx