Setting The Focus On Popup Panel?

Apr 19, 2010

I use a modalpopupextender to show a popup when the user clicks on a button.

<ajaxToolkit:ModalPopupExtender ID="mpe1" runat="server" TargetControlID="statusInfoLb" PopupControlID="statusInfoPanel" DropShadow="false"
OkControlID="okBtn" OnOkScript="onOk()">
</ajaxToolkit:ModalPopupExtender>
<asp:Panel ID="statusInfoPanel" runat="server" Height="185px" Width="454px" SkinID="Panel_Notification2" DefaultButton="okBtn">

The panel has an OK-Button to dispose the popup. It is also possible to click Return to dispose the popup, because the panel has the property DefaultButton="okBtn".

But this only works when the popup has the focus, which is not so from the start. How do I get the popup panel to have the focus when it shows? I would like to use jQuery.

View 1 Replies


Similar Messages:

AjaxToolkit ModalPopupExtender - How To Set Focus To A Control In The Popup Panel

Jan 7, 2010

When the user pushes the Button, I'd like to display a modal dialog box to capture a couple of values from text boxes and submit these values to the server. When the modal box is shown, I'd like the cursor to be placed in the txtFirst textbox. How do I do this? I've had trouble with registerscript commands before, so if one is needed, I hope the syntax, if you provide it, is correct.

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="MyModalSimple.aspx.vb" Inherits="MyModalSimple" %>
<%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" tagprefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script type="text/javascript">
function onOk() {
form1.submit();
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="Button1" runat="server" Text="Button" />
<cc1:modalpopupextender id="Button1_ModalPopupExtender" runat="server" targetcontrolid="Button1"
popupcontrolid="pnlModal" okcontrolid="btnOK" cancelcontrolid="btnCancel" DropShadow="true" OnOkScript="onOk();">
</cc1:modalpopupextender>
<asp:Panel ID="pnlModal" runat="server" Style="display: None1"
BackColor="#CCCCCC">
<br />
<table>
<tr>
<td>
<asp:Label ID="lblFirst" runat="server" Text="First"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtFirst" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lblLast" runat="server" Text="Last"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtLast" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td align="right">
<asp:Button ID="btnOK" runat="server" Text="OK" />
<asp:Button ID="btnCancel" runat="server" Text="Cancel" />
</td>
</tr>
</table>
<br />
<br />
</asp:Panel>
</div>
</form>
</body>
</html>

Also, how could I change the above code so that the modal dialog was displayed as a result of a selection of a dropdownlist item? If I set the targetcontrolid="DropDownList1", the dialog box is display when it drops rather than when a selection is made

View 1 Replies

AJAX :: Odd Behavior On Setting Focus In User Control With Update Panel?

Nov 9, 2010

I'm having a bit of an issue in my ASP.Net application moving focus from a textbox in one user control to a text box in the next user control on the page after postback. I've searched high and low over the last several days to find a solution but, for whatever reason, have been unable to do so.

I have a page that has user controls loaded dynamically to allow a user to enter data.The number and type of user controls loaded to the page is determined at run time based on a database query.It is possible than many controls of the same type can be loaded. Each user control has its own update panel. Within the update panel of each control is a regular asp panel. Inside of the regular panel there are at least 2 server controls (any other controls that may exist in the user control are not affected by this issue) - a text box and a button.The defaultbutton property of the regular panel is set to the ID of the button within the user control. The desired behavior is to allow the user to enter data into the textbox on one user control hit enter to save the data on that user control the application will set focus to the textbox of the next user control on the page after the data from the "current" user control has been saved. Other considerations;

The application uses master pages. We make extensive use of ajax and the ajaxtoolkit in the application. I am using Visual Studio 2010 and .Net 4 The issue - when first entering the page, one can enter data into the first textbox and press the enter key. Data from "current" user control is correctly saved and focus is correctly moved to the next user control on the page.

Data can be entered into the textbox of "new" user control and when the enter key is pressed, the data is correctly save. The focus appears to move correctly to the next user control on the page.Data cannot be entered into the textbox of the control. Pressing the enter key will not save the data (because none was entered) but the focus will move to the textbox of the next user control on the page.

Data can be entered into the textbox of the user control. When the enter key is pressed, the data is correctly saved and the focus appears to move correctly to the textbox of the next control on the pageBasically, steps 3 and 4 are repeated until the end of the user controls on the page, alternating between being able to enter data and not. Other items of note When one is able to enter data into the textbox of a user control, one can correctly tab through the textboxes of each user control until the end of the page When one is not able to enter data into the textbox of a user control, pressing the tab key will take the focus to the address bar of the browser.

I created a much simplified example of the scenario described above and was able to consistently reproduce the "bad" focus behavior. All of the ajax toolkit controls and code where stripped out of the sample to rule the toolkit out as a cause. The behavior still occurs without the toolkit.

I am including the code for default.aspx and WebUserControl1.ascx.

[Code]....

[Code]....

[Code]....

[Code]....

View 2 Replies

AJAX :: Modal Popup Click Control Within Panel Is Closing Popup

Jul 27, 2010

I'm using modal popup extender and panel with calendar in it. Click the "Next / Previous Month" closes the modal popup. How do I tell the modal popup to ignore click events in a calendar control inside the panel targeted for popup? I'm confused because when using extender before, you had to click OkButton or Cancel to close popup. I have update panel for reason. I just minimized the code for easy review.

[Code]....

View 5 Replies

Web Forms :: Setting Focus To Web Control

Jun 30, 2010

Can anyone give me some VB to set focus to a control using the "FindControl" method. MyTextbox.focus() is not good enough because, for instance, I have a textbox called "Username" in the "CreateNewUserWizard" control which is within a Contentplaceholder on a child page so typing in "Username.focus()" does not work on the Page_Load event because Username simply does not have a Focus property.

View 1 Replies

C# - AutoPostback Not Setting Focus Correctly?

Dec 29, 2010

I have a page that when auto or partial post back happens, focus is set to the address bar rather than the next control. The interesting thing is that when I put an alert in my RadScriptBlock, after the OK is clicked, focus goes to the correct control -or- if I put in an invalid location, focus is returned to the ExpLocation control & when a correct location is input the second time, the tab order/focus command works correctly (see code below).

That has this up top

[code].....

View 2 Replies

Setting Focus To A Textbox Using Vb.net / 2005

Oct 21, 2010

using vb.net/asp.net 2005 after the user clicks on a button in the buttonClick event I am trying to set the focus at the end of the function simply as follows:

[Code]....

However the focus is instead going to another button. The tabIndex property is not set on any controls on the page.

View 9 Replies

AJAX :: Panel And Popup Extender Can Show The Popup But It Is Not Movable?

Jan 13, 2010

I wish to write a modal dialog box for my project, similar to this http://obout.com/editor_new/howto_sc.aspx.Which is very simple:When a user click on a button,the page will make a call to a web service and when it is done,a Movable Modal Dialog box will show and populated with my data, along with buttons and scripts for those buttons.It seems that the panel and popup extender can show the popup but it is not movable.Should I do it with AJAX tool kit or using pure Javascript, I see a few sample on the web, but it is kind OF complicated.

View 5 Replies

Setting The Application Focus On Other Areas Of A Form?

Jun 24, 2010

I am not sure how to explain my current issue. Right now I have a Form that spans a couple of pages. I have divided the Form into multiple section as well including a File Upload section, a File Download section, and have an 'Update' button at the bottom of the Form. I also have Error labels within each section, and have an Error label at the bottom of the Form under the 'Update' button.The problem that I am experiencing right now is that when I produce one of these errors, the Form automatically displays the very top of the page. So in other words, if the error message is displayed at the bottom of the Form, the user has no idea unless they scroll all the way down.Is there anyway to keep the application focus at the area where the button is clicked on? This way if the user produces an error, they will see it right away.

View 4 Replies

Setting The Focus At End Of Text In A Textbox-element?

Nov 4, 2010

Is it possible with easy options in ASP.NET to set the focus at end of text in a textbox-element ? Without JavaScript ?

View 1 Replies

MVC :: Setting The Focus To A TextBox On Page Load

Jan 11, 2011

In my markup, in addition to a number of other controls I have the following:

<%:Html.TextBoxFor( m => m.UserName)%>

I'd like to be able to set the focus to this textbox when the page is loaded. Is there a really easy way to do this? I have to admit that so far I haven't found it. I know that I can do this using something like this JQuery/Javascript code: $('#UserName').focus();

However, I don't like the fact that the model field name 'UserName' has to be expressed as a string constant again here - it smells of a maintenance problem. I'd really like to be able to reference the model field directly if possible. Somethiing like this: $('#' + '<%:Html.ModelFieldNameFor(m => m.UserName)%>').focus();

View 2 Replies

AJAX :: Setting Focus Back On Page

Jan 11, 2010

I have wierd situation on my side. I have a page that uses a user control driven by ajax. When I enter a code in txtbox. Corresponding questions for that code are brought into the middle section of page basically in user control. I have requirement of setting the focus on the controls so that I can tabout the field with feel of questions being a part of same page.

I have to manually set the focus for the first question and after going thru all the questions I get control lost. Basically it dont come back to the actual page. I have tried to manually put the focus on the button but I couldnt.

View 3 Replies

AJAX :: Setting Focus To A Textbox In Modalpopup

May 11, 2010

I have a panel which contains a textbox and a button. The panel will be shown as a modal popup using the 'modal popup extender' . I want to set the focus to the textbox in the panel when my modal pop up loads .

View 4 Replies

AJAX :: AutoCompleteExtender Breaks On Setting Focus

Jun 16, 2010

I have an autocomplete extender on my page and it works fine. However as soon as I set focus of its textbox via either straight javascript or codebehind the autocompleteextender no longer works.

View 2 Replies

JQuery :: Setting Focus To Current Item

Feb 24, 2011

We have an ASP.NET MVC application which uses lot of JQueries. One of them I found is following:

function (data)
{
updatePoints(function ()
{
$('#point-list>li').last().click();
});
});

This sets the focus to the last point in my list but I think its not good idea because when I click save button to update my intermediate point, it automatically set the focus to last point. I want it to stay on the same point after refresh. Is it possible to do? Is there any property like Current()?

View 4 Replies

AJAX :: Calendar Extender Setting Focus To Its TargetControl

Aug 5, 2010

i have calendar extender that has targetcontrol property set to a textbox and i want the focus to be on that textbox after the user select a date , i have tried with this OnClientDateSelectionChanged = "SetControlFocus();" in which SetControlFocus is a javascript function that set the focus to the textbox with this line document.getElementById('txtbox').focus(); but it didn't work!

View 5 Replies

AJAX :: Setting Focus On TextBox When HTML Editor Is Used?

Jun 19, 2013

I have Web App. in that One note control and one textbox,when I run the app then cursor focus the note but I want to focus on textbox,I have use Focus property but their is no work

View 1 Replies

Setting Focus To Textbox In Login Control On Page Load?

Jun 15, 2010

I am trying to set the focus to the user name TextBox which is inside an ASP.NET Login control.

I have tried to do this a couple of ways but none seem to be working. The page is loading but not going to the control.

Here is the code I've tried.

SetFocus(this.loginForm.FindControl("UserName"));
And
TextBox tbox = (TextBox)this.loginForm.FindControl("UserName");
if (tbox != null)
{
tbox.Focus();
} // if

View 3 Replies

Web Forms :: Setting Focus On Page Load Doesn't Work?

May 6, 2010

I have been browing forums & googling for a couple of hours this morning, trying to find an answer to what (to me) should be a very simple issue. (I am a Delphi programmer moving somewhat reluctantly to Visual Studio C# , for web apps) I have created the simplest ASP.NET website in Visual Studio, containing a Textbox and a Button. When the website loads, I want Textbox1 to have focus. Simply doing

[Code]....

and this too does not work. However, if I press the Enter key when the webpage is displayed, then focus does move to TextBox1 (and pressing Enter again will fire any code attached to Button1). Surely it cannot be this hard to perform something so simple?

View 9 Replies

AJAX :: Keeping The User In Appropriate Form Location - Setting Focus?

Feb 1, 2011

I used Ajax collapsible extenders (1 to 9) with formviews in each of them on a web form.

They are all collapsed by default. If the user enters data in collapsible 5 formview and submits data, the page refreshes back to the top of the page (where the collapsible 1 is positioned). I would like the focus to stay in the region the user is working (even after insert/submit operations). How can I do this.

View 4 Replies

Setting Focus On Text Field On Initial Load Of Form

Apr 15, 2010

I want the cursor to appear on the first text box in my screen when user goes to the site I have coded this but no cursor is placed in textbox

<form id="Form1" defaultfocus="TextboxTelephone" method="post" runat="server">

I have to tab to get cursor in first textbox telephone.

View 3 Replies

AJAX :: Setting Focus On ModalPoupExtender From Code Behind Show() Method?

Feb 22, 2011

I have figured out a method for displaying a modal popup using the ACT ModalPopupExtender from the server side.This is really important because there is a fair amount of server side initialization that I require prior to showing the dialog.

Basically, I assign a dummybutton as the TargetControlID. Then I define a link button such that when clicked it fires an OnClick event. The handler then does whatever initialization is necessary and uses the show() method of the ModalPopupExtender. This is not rocket science. However, what appears to be rocket science is getting a control within the MPE to get the cursor focus. The problem as I see it is that because I am manually showing the dialog, the JS add_shown function never fires. Of course the add_shown function is attached through JS by using the behavior ID of the MPE. It appears to be the standard way to set focus within a MPE dialog. It appears to only work if the targetcontrolid is a real button that shows the MPE dialog when clicked.

Is it possible to set the focus within a MPE dialog when you are programatically showing the dialog and not attaching a real button press event to the MPE Target Control ID? Obviously the Page.SetFocus or Control.Focus() do not work either before or after the modal dialog is shown:

protected void SignIn_Click(object sender, EventArgs e)
{
Session["InTimeOut"] = true;
Session["logintries"] = 0;
SI_user_login_id.Focus(); /// ---> This does not set the focus either before or after the show method
this.ModalSignOn.Show();
}

View 6 Replies

Set Focus On The First Textbox Control In A Popup (modal)?

Oct 1, 2010

How can i set focus on the first textbox control in a popup (modal)? It's a login window.

I tried javascript, but that failed.

View 5 Replies

AJAX :: To Authenticate A User Using Model Popup Extender / Model Popup Extender Popup Panel Keep Visible

Feb 18, 2010

I want to authenticate a user using model popup extender. So I wrote a program to do this. Everything OK when user enter the correct details. But user enters the wrong detail, it should shows in a lablel in a popup panel. It shows; but the problem is it close the popup . But I want to keep the popup if the user enters the wrong details. How can I do this?

View 5 Replies

AJAX :: Set Focus To Textbox In Modal Popup Extender?

Nov 24, 2010

I have a page which displays a modal popup window.

In the popup window I have a textbox and 2 radio buttons. How can I set focus to the textbox when this popup window is displayed.

View 4 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved