Solved

ModalPopup Message Box

Posted on 2009-05-19
6
325 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…

707 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