Wrox Programmer Forums
|
ASP.NET 3.5 Professionals If you are an experienced ASP.NET programmer, this is the forum for your 3.5 questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Professionals section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 27th, 2011, 09:43 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 121
Thanks: 1
Thanked 0 Times in 0 Posts
Default Set Focus on ModalPopupExtender

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();
} 
}
}





Similar Threads
Thread Thread Starter Forum Replies Last Post
set focus sameer_1981 Intro Programming 1 February 27th, 2007 09:14 AM
set focus akibaMaila VB.NET 2002/2003 Basics 1 July 12th, 2005 05:56 PM
how to set focus waley .NET Web Services 1 May 25th, 2004 02:38 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.