Solved

ModalPopup Message Box

Posted on 2009-05-19
6
320 Views
Last Modified: 2012-05-07
I have a datagrid that allows the user to update its contents, however, it does not update the database, instead, it emails a supervisor that changes need to be made and what those changes are.  This is fine.  However, I would like to have a modal box pop-up that tells the user the supervisor has been notified.   have this almost working by putting Show() in the onUpdating event but it acts wierd.

First I don't know what to attach the extender to.  If I attach it to the datagrid, the pop-up comes up when the user hits edit instead of when they hit update.  Obviously not desireable.  

Second, the panel that is in the popup is momentarily visible when the page loads, also not a desireable effect.

Currently I have the extender attached to a button but I don't want this button on the page.

Can I get some advice here?

Thanks!
0
Comment
Question by:jglazer63
  • 3
  • 2
6 Comments
 
LVL 7

Accepted Solution

by:
kGenius earned 500 total points
ID: 24425500
For hiding the panel when page loads; add a CSS-class to the panel.
In your css give the class display:none;

For the first problem; you can create a buttonfield visible in editmode.
Add CommandName="ShowModal" to the button and OnRowCommand="GridView1_RowCommand".
Then in your code-behind add:

public void GridView1_RowCommand(Object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "ShowModal")
{
  youModal.Show();
}

Then you also call your update/e-mail function

HTH,
jaan
0
 
LVL 9

Expert Comment

by:tetorvik
ID: 24425647
you can also use hidden button (style display:none) as a control for TargetControlID if you don't want any additional (visible) controls on your page.
0
 

Author Comment

by:jglazer63
ID: 24425757
I have a better queston.  What is the best way to develop some procedure to have a standard pop-up modal message box.  This kind of thing would be used throughout the site.  Assume I have no controls in particular on the form but some sort of event could fire the need for the box.
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
LVL 9

Expert Comment

by:tetorvik
ID: 24425970
Don't know about the best way, but we've implemented an alert user control that wraps the ModalPopup control and all the other necessary controls. Then on a BasePage that all the pages in our application derives from we have methods to dynamically load the alert control on the page.
This approach has been working greatly in our scenarions.
0
 

Author Comment

by:jglazer63
ID: 24426068
Can you expand on this a bit?   Perhaps some code?
0
 
LVL 9

Expert Comment

by:tetorvik
ID: 24428768
First of all I need to say this is getting little of topic from the original question in which kGenius answered very well (IMO an accepted solution). I think if the question focus is changing in a thread, it would be fare to reward the correct answers so far and the then start a new question.

Unfortunately I cannot provide the exact code as it is not really my property, but I can say there is no magic in this.
Simply putting the mark-up you have for ModalPopup into User Control and expose some methods to control ModalPopupExtender visibility and some properties for message text and message severity. I encourage to create an interface for this (see INotificationControl used below), so when you're are using the control you can do that throught the interface.  Then you can load to control dynamically on your page with the snippet below:



                INotificationControl notifier = LoadControl(@"~\SomePath\NotificationControl.ascx") as INotificationControl;
                ((Control)notifier).ID = Guid.NewGuid().ToString();
                notifier.NotificationText = "Some text";
                notifier.Show();
                this.Form.Controls.Add(notifier as Control);

Open in new window

0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
ASP.NET(C#) Eliminating weekends from a date range 2 45
Finding the IIS version 5 21
VB.NET Textbox input validation 4 37
Change to file doesn't show up 16 50
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

789 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question