I have an asp.net application where some of the interaction with the
user is through modal dialog windows. This works very well except for
the annoying fact that the dialog window always returns to its initial
position when the user posts back (by clicking a button, etc.)
I have all of the fundamentals for asp.net modal dialogs in place, such
as using <base target="_self"> in the header...
To reiterate the problem for the sake of clarity: The users would like
to be able to reposition the modal dialogs and have the dialog maintain
its position when a postback is caused via clicking a button, etc.
Instead the modal dialog always returns to the position where it was
initally created.
What technique can I use to have the modal dialg remember its position
on postback.
This is an important issue for my client. I will post to this
newsgroup the solution I find (whether by assistance from
comp.lang.javas cript, etc. -- or by my research).
Thanks,
Rod 3 6638
I have found a 90% solution for how to get a modal dialog to maintain
its position after postback. (More later on the remaining 10%.)
In a nutshell, when the user clicks a button or other control that
causes a postback/submit, I retain the window.screenLe ft and .screenTop
in hidden text inputs, and include script to set the window.dialogLe ft
and .dialogTop in the response.
This is not a 100% solution. The dialog maintains its postion, but if
you move the dialog and then do a submit/postback, it will jump back to
its original (prior to moving the dialog) position for a brief moment
until the positioning script is run to place it to where you moved it.
I haven't figured out how to overcome that, so I appreciate any
suggestions or ideas.
Now for more details. First of all, this is an ASP.Net appliction with
VB.Net as the server-side codebehind langauge. In the dialog, I have
two hidden <aspnet:textb ox runat="server"> controls whose IDs are
hidXPos and hidYPos, respectively.
I have a javascript function whose purpose is to retain the current
window position. It is placed in the onclick event handler for any
control that does a submit/postback -- prior, of course, to doing the
submit.
function RecordPosition( ) {
var ohidXPos = document.getEle mentById('hidXP os');
var ohidYPos = document.getEle mentById('hidYP os');
ohidXPos.value = window.screenLe ft;
ohidYPos.value = window.screenTo p;
}
In the server-side code-behind, the Page_Load sub, which handles the
Page Load event, contains the following code snippit. Notice that I
subtract 3 pixels from dialogLeft and 22px from dialogTop to compensate
for thw window border and caption bar.
If hidXPos.Text <> "" And hidYPos.Text <> "" Then
Dim strScr As New System.Text.Str ingBuilder
strScr.Append(" <script language='javas cript'>" & vbNewLine)
strScr.Append(" window.dialogLe ft = '")
strScr.Append(h idXPos.Text - 3)
strScr.Append(" ';" & vbNewLine)
strScr.Append(" window.dialogTo p = '")
strScr.Append(h idYPos.Text - 22)
strScr.Append(" ';" & vbNewLine)
strScr.Append(" </script>" & vbNewLine)
RegisterStartup Script("positio n", strScr.ToString )
End If
This produces script that looks like the following, for example:
<script language='javas cript'>
window.dialogLe ft = '259';
window.dialogTo p = '117';
</script>
Another idea I tried unsuccessfully was to set window.dialogLe ft and
Top in the above RecordPosition function. That seemed to have no
effect.
Thanks,
Rod
In article <11************ **********@g14g 2000cwa.googleg roups.com>, RE****@jswcoinc .com enlightened us with... To reiterate the problem for the sake of clarity: The users would like to be able to reposition the modal dialogs and have the dialog maintain its position when a postback is caused via clicking a button, etc. Instead the modal dialog always returns to the position where it was initally created.
What technique can I use to have the modal dialg remember its position on postback.
Is this postback occuring in the parent window or the modal dialog?
--
--
~kaeli~
If the funeral procession is at night, do folks drive with
their lights off? http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
The postback is occuring in the modal dialog. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Earl Teigrob |
last post by:
Can a Modal Dialog Box do forms ASP.NET forms validation from within the
Modal Box? I want to pop up a dialog box to the user and have it do its own
post backs with validation checking and then save the data and close the
dialog when the page is valid. I have read a little about using Iframes to
post back to, but was wondering if this would work for what I am trying to
do? Also, does anyone have a code sample of this (postback from modal...
|
by: Brian Henry |
last post by:
Hi, is there a way to get a form to post back to a modal dialog box when it
was posted from a modal dialog to start with? here is the problem... I have
a form with combo boxes and when you select one then click on an add button
it adds the item to a list box, but when you click on add (this is in a
modal dialog box) it opens the postback in a new window outside of the modal
dialog box, how do you force it to postback to the modal dialog?...
|
by: A Traveler |
last post by:
Hello all,
Here is my situation... i have a page which has a dropdown of companies.
Next to it i have a "New" button for creating a new company. What i would
like to do is to show a modal dialog with the company entry screen, then
once it is dismissed, let the button continue with its postback and rebind
the companies dropdown to include the new company.
What i tried was to put in a javascript function in my html
> function...
|
by: Guadala Harry |
last post by:
I have a modal dialog that currently does all of the following except item
4.
1. lets users select a graphic from a list of thumbnails (and when selected,
displays the full-size image in a preview DIV)
2. when users close the dialog, the application receives the URL to the
selected graphic.
3. the modal dialog lets the users upload a new graphic if the dialog does
not present them with one they are already happy with.
4. upon uploading...
|
by: John |
last post by:
Hi all,
I have a situation where I'm using a modal dialog to merely show the user
some data. Once the user has finished, there is only one button to click to
return to the previous (parent) page but a postback is done. The modal
dialog is invoked from a linkbutton on the parent.
How can I prevent this unnecessary postback?
Regards
| |
by: sthrudel |
last post by:
Hi!
I'm working on a web application in Asp.net and what I would like to
have is a cross borwser modal dialog which accepts user's input.
I would like to catch what the user clicked on the dialog. To be more
specific I want to have a confirmation dialog that is shown when a user
clicks on a Delete button (which deletes some values from database). If
Yes is pressed the delete action is processed otherwise modal dialog is
closed.
|
by: bern11 |
last post by:
If Form1 opens Form2 modally, how do I capture clicks on Form1 when
Form2 is open? I want to click on Form1 and read the mouse co-ordinates
into Form2. Since Form2 is open modally, Form1 mouse-events do not
fire. What events on Form2 fire?
I could open Form2 modelessly, then process from within Form1 mouse
events. Is there any other way?
|
by: VK |
last post by:
In the continuation of the discussion at "Making Site Opaque -- This
Strategy Feasible?" and my comment at
http://groups.google.com/group/comp.lang.javascript/msg/b515a4408680e8e2
I have realized that despite suggestions to use DHTML-based modal
dialogs are very common? there is not a single fully functional
reliable copyright-free cross-browser alternative to say MsgBox
(VBScript) or showModalDialog (IE). This way such suggestions up to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
| |
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |