• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 336
  • Last Modified:

ModalPopup Message Box

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
jglazer63
Asked:
jglazer63
  • 3
  • 2
1 Solution
 
kGeniusCommented:
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
 
tetorvikCommented:
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
 
jglazer63Author Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
tetorvikCommented:
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
 
jglazer63Author Commented:
Can you expand on this a bit?   Perhaps some code?
0
 
tetorvikCommented:
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

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!

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now