I have a modalpopup that I use to show an error message and I call the Show() method from code behind when validation fails. I have the modalpopup linked to a hidden input, but when the Modal is shown I try to set the focus on the default button but it is
just not happening. I tried to set it manually from code behind and on client side but it isn't working.
I have the DefaultButton="MyButton" in the panel. I only have one button in my panel, but the thing is that if I link the modalpopup to the button where I want to do validation it puts the focus in the ok button. The problem is that this way no validation
can be made from code behind, and if I call the modalpopup.show from code behind (server side) the focus doesn't get to the ok button.
maufonfa
Member
72 Points
29 Posts
Manually called ModalPopupExtender not putting focus on default button
Feb 23, 2012 03:49 PM|LINK
I have a modalpopup that I use to show an error message and I call the Show() method from code behind when validation fails. I have the modalpopup linked to a hidden input, but when the Modal is shown I try to set the focus on the default button but it is just not happening. I tried to set it manually from code behind and on client side but it isn't working.
ModalPopupExtender
adamturner34
Contributor
3952 Points
997 Posts
Re: Manually called ModalPopupExtender not putting focus on default button
Feb 23, 2012 04:11 PM|LINK
It should default to the OK button. How many buttons do you have?
In any event, pretend your default button is the OK button and your problem is solved.
maufonfa
Member
72 Points
29 Posts
Re: Manually called ModalPopupExtender not putting focus on default button
Feb 23, 2012 04:23 PM|LINK
I have the DefaultButton="MyButton" in the panel. I only have one button in my panel, but the thing is that if I link the modalpopup to the button where I want to do validation it puts the focus in the ok button. The problem is that this way no validation can be made from code behind, and if I call the modalpopup.show from code behind (server side) the focus doesn't get to the ok button.
maufonfa
Member
72 Points
29 Posts
Re: Manually called ModalPopupExtender not putting focus on default button
Feb 23, 2012 04:38 PM|LINK
I did it with the help of this post http://forums.asp.net/p/1111803/4078130.aspx#4078130. It works like a charm now :D.