Hello Programmers,
I am having BIG problem on setting the focus inside my ModalPopupExtender control. I have a simple message popup box (created using this control) with OK button to âdismissâ the box. The situation in my case is like this:
I have Master Page with toolbar. On this toolbar I have the âSave Recordâ button. After the user click this button and the record has been saved successfully, the user will see the pop-up message box that the record has been saved. The user is pressing the button to close the box. Everything works fine from the toolbar. But the user asked me to let them save the record using F10 function key. I let them do this, but now I have a problem: by some reason (actually this is my guessing the reason:âThe message pop-up box loosing the focusâ) the user supposes to click the OK button twice to close the message box.
Any suggestions,directions or help to solve this problem will be appreciated. 
Thanks,
Dmitriy
p.s.
Bellow is my modal pop-up box
Code:
<divid="divModalPopupSavedData">
<cc1:ModalPopupExtenderID="ModalPopupSavedData"runat="server"TargetControlID="dummySavedData"
PopupControlID="PanelSavedData"BackgroundCssClass="modalBackground"DropShadow="true"
OkControlID="OKButtonSavedData"OnOkScript="SetFocusAfterSave()">
</cc1:ModalPopupExtender>
<asp:LinkButtonrunat="server"ID="dummySavedData"CssClass="noDisplay"Text="Click me..."/>
<asp:PanelID="PanelSavedData"runat="server"CssClass="modalPopup"Style="display: none"
Width="270px"BorderStyle="Double"ScrollBars="Auto">
<br/>
<tablestyle="width: 100%;"bgcolor="#79A9B9"cols="2"align="center"cellpadding="2"
cellspacing="2"border="2"bordercolor="olive">
<tr>
<tdalign="center">
<b>Attention User!</b>
</td>
</tr>
<tr>
<tdalign="center">
Data has been saved.
</td>
</tr>
</table>
<br/>
<divalign="center">
<asp:ButtonID="OKButtonSavedData"runat="server"Text="OK"/>
</div>
</asp:Panel>
<br/>
</div>
This is the part of my delegate function to show the message:
Code:
privatevoid SavePageData(object sender, EventArgs e)
{
.
.
.
this.ModalPopupSavedData.Show();
.
.
}
This is script on Master Page to call the SavePageData() function
(actually this script is involving the same "Save Record" button click on the toolbar wich is working OK as I've described above):
Code:
<scripttype="text/javascript">
//Implementing all Keyboard shortcut keys here:
document.attachEvent('onkeyup', KeysShortcut);
//Now we need to implement the KeysShortcutfunction
function KeysShortcut ()
{
var control = null;
if (event.keyCode == 121) //F10 key for the button "Save" //D.M. 12/29/2010 To tie F10 keyboard button to the "Save" functionality
{
control = document.getElementById("ctl00_btnSave");
if (control != null)
{
control.click();
}
}
}