.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

The Jquery dialog appears but the focus goes to the top of the page

Posted By:      Posted Date: May 22, 2011    Points: 0   Category :ASP.Net

Hi, I have a jquery dialog box(red rectangle with a cross) when triggered(via the click button) appears at the top of the page(in the browser - see left part of the diagram) and the page focus  goes to the beginning of the website(see the right part of the diagram).

I need the dialog to appear such that the focus does not go to the beginning of the website as shown in the right part of the diagram above, 

but appears like in the left part of the diagram.

Here is the code:

$(function() {
        $("#location-search-id").click(function() {
                modal: true,
                open: function() {
                    $(this).load('<%= Url.Action("LocationSearch", "Tab") %>');
                position: 'top',
                width: 650
        return false;

Here are the jquery scripts I have referenced:

    <link href="<%=Url.Content("~/Content/themes/base/ui.all.css")%>" rel="stylesheet" type="text/css" />
    <link href="<%=Url.Content("~/Content/themes/ui-lightness/jquery-ui.css")%>" rel="stylesheet" type="text/css" />

View Complete Post

More Related Resource Links

show / hide jquery modal dialog box on page load



i have a jquery modal dialog box which displays on page load of my asp.net web app - i am using asp.net aspx pages and c#

how can i hide this pop up if a value for example is false and display it if a value is true?

the following is my jquery code:

$(function() {


modal: 'true',

title: 'title'



any advise would be much appreciated as i am new to jquery and its quite a learning curve

many thanks


Refresh Parent Page when close the jquery dialog



I have to open PopupPage.aspx from MainPage.aspx using jquery Dialog. For this i have added the iframe inside the Div and loaded the PopupPage.aspx in the iframe. 


    <link href="inc/css/jquery-ui-1.8.6.custom.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript" src="inc/scripts/jquery-1.4.2.min.js"></script>
    <script type="text/javascript" src="inc/scripts/jquery-ui-1.8.6.custom.min.js"></script>

    <script type="text/javascript" language="javascript">
        function OpenJQueryDialog()
            $('#dialog-modal').dialog({ autoOpen: false, bgiframe: true, modal: true });                         

Using jQuery to directly call ASP.NET AJAX page methods

Here I am looking to explain how to call page methods using jQuery. Using jQuery to directly call ASP.NET AJAX page methods

ASP.NET GridView - edit records using JQuery Dialog

There are many ways in which you could modify modular data in Grid View:
1. Inline by making rows editable when u click on Edit
2. By using separate pages for Edit
3. By using popups/dialogs for adding/editing

Reduce ASP.NET Page size and complexity using JQuery

This is my first post on asp.net blog. ASP.NET Ajax and JQuery are two different ajax framework. In this post I will show, how we can enhance gridview using ASP.NET Ajax and JQuery. I also compare the implementation of these frameworks. In next posts i will explain more about JQuery and ASP.NET Ajax and also tell you "How to combine the power of both framework". My Future post will related to ASP.NET and related frameworks.

Open ModalPopup dialog on page load


Is there a way to make a modal popup panel active on page load so that the user can't do anything until they deal with the popup dialog?

JQuery Treeview plugin is not working with Ajax page load in ie8


Hi there,

I developed a page where i m using jquery treeview plugin to generate tree. It worked fine on FF, IE8 with out ajax.

But when my page loads thro' ajax call in IE8, it is not collapsing or expanding tree.

Any idea?

Thanks in advance.

Refreshing a Jquery modal dialog after closing another Jquery modal dialog


I have one aspx page which contains a webpart. The structure of the webpart is:

Webpart(holds one user control say UC1)

      UC1-> contains another user control say (UC2) in a <div>, which I am going to show as a popup on clicking of a link button inside a gridview in UC1.

      UC2-> contain another user control say (UC3) in a <div>, which I am going to show as a popup on clicking of a button inside in UC2.

That means -> UC1(main page) ------->(Onclick) One JQuery popup(UC2)--------------->(OnClick) One Jquery popup(UC3) here UC2 is still remaining in focus and UC3 will be another Jquery popup on UC2.

Now my requirement is when i fill the Jquery popup(UC3) and click on save button in UC3, I would like to close UC3 Jquery popup and refresh the gridview inside UC2 Jquery popup without closing it.

Is this possible?(please explain the logic if found in terms of Jquery, but not in terms of normal popup windows)

How to Pass UserName & Password to codebehind page using jquery

here is login form I would like to use.
Right now it is not communicating with my codebehind page.
How do I modify the jquery  login code to post the username and password to the codebehind?
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="Default2" %>

<!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">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<link rel="stylesheet" type="text/css" href="styles/chop1.css" />
<script type="text/javascript" src="js/chopjs/jquery-1.3.2.min.js"></script>

<script type="text/javascript" src="js/chopjs/three.js"></script>
<!--[if IE 6]>
<script type="text/javascript" src="js/ie_png_fix.js"></script>

Is there a function in Jquery which run only one time no matter load page or PostBack

In asp.net, I can use Method A to run somethings A one time, and somethings A will nor run when page is postback but In JQuery, I hope to run something B one time when the page is loaded, but if I use Method B, the "Somethings B" always run even the page is pastBack, how can I do? Thanks! ------------------Method A------------protected void Page_Load(object sender, EventArgs e){    if (!IsPostBack)    {       //Do Somethings A    } }   ------------------Method B------------$(document).ready(function () {   //Do Somethings B})

Can I write a wcf endpoint to communicate with JSON from Jquery on page?

Hi Guys,I need to be able to expose information to a page, and I need to write the information in xml on my webserver which will be dynamically created from the database. I need to use json to pass the data from the screen back to the server two way communication xms back and forth. Is it actually any good using a wcf endpoint to serve the json back to the page and use query with wcf? Is this possible?Or is it easier to use standard pages .aspx and just do a call to a url and get the json with jquery....We will probably want to send this information to other locations at some point in the future too....Cheers,Pete

Custom Edit form - close modal dialog and navigate to page

Hi, I created one custom edit form for my document library, replaced default save and cancel buttons with input buttons and added the form action to them. Then I set my page as default edit form. When I click edit button, my custom form opens in modal pop up. When I try to save the item by clicking new save button, item gets saved but pop remains as it is. Now, I want the modal pop up to get closed and navigate to page other than the parent page with some parameters after I click save button. How can I achieve this? Thanks!!

JQuery(Effects problem) With Master Page

HI friends, My project is old one it is bulit in VS2005 now i want to add the features of JQuery I m new to JQuery.I started working with simple hide and show functionality on div . It works fine with simple aspx page but  it does not work with MASTER PAGE when I apply hide and show functionality with toggle('slow'),slideup('slow'),slidedown('fast')  etc effects . I have set the property of div as runat server. Any help appreciated Regards, Chandrakant            

reCaptcha+jquery ui modal dialog

Hi, I would like to have a contact form which contains a reCaptcha, and have that form inside a jquery ui modal dialog. All works well, except that I have a submit button for the form - which closes the modal dialog wether the recaptcha is valid or invalid. I tried adding onClientClick="return false;" to the submit button, but it still posts back, and closes the dialog. how do I remain inside the dialog ?

page.setfocus(listbox.selecteditem) is not setting the focus if index > 820

Hi All, Does any one know the reason Why I am unable to setfocus to my list box if the index > 820 My list box contains 2000 items and the index is not  able to set the focus if the index > 820  

Refresh Parent Page List after Edit Item Modal Dialog Save/Close

I am calling the Edit Item URL (EditForm.aspx?ID=x&IsDlg=1) via javascript code to bring up the Edit Item Modal Dialog. This works fine and dandy. But what callbackfunction should I invoke after the Save so that the parent list is refreshed? Is there a better way to do it than call reload on the entire parent frame? It almost looks like there should be a way to refresh just the list. Any help appreciated. Thanks, Jake.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend