Solved

ModalPopup Message Box

Posted on 2009-05-19
6
317 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Wordpress Query 1 35
What is MicroStrategy.NET? 2 47
Problem to picture file 3 41
ASP.NET reading ATOM 2 27
In an ASP.NET application, I faced some technical problems. In this article, I list them out and show the solutions that I found.  I hope it will be useful. Problem: After closing a pop-up window, the parent page should be refreshed automaticall…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

746 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now