Popup control from dll in web page
I'm developing a kind of framework that will work in web and win, so I have this interface:
public interface IViewsManager
{
...
void ShowMessage();
...
}
And I have the implementation for win that call a popup control from another dll. My problem is when I try to implement it for web enviroment, I have to call a popup control from another dll, and I would like to show the popup and the web page disables with a gray layer, and I don't know how to do it.
The structure is like the following:
开发者_如何转开发1) UI.Common
a) IViewsManager
2) UI.Win
a) ViewsManagerWin
3) UI.Web
a) ViewsManagerWeb
4) UI.Controls
a) PopupControlWin
b) PopupControlWeb
5) Web Application
And from my web application I call the IViewsManager.ShowMessage, and depending on the enviroment it calls the appropiate popup control.
Please, any help will be appreciated. Thanks in advance.
I think you're a little confused ...
You can't "Show controls from the pages code behind"
Essentially if you want to popup a dialog you can do it with a Javascript function "ON THE CLIENT SIDE", the aspx pages code behind is behind executed on the server which means visually you can't reall do much at all unless you want your host to see it and noone else.
There is one other option to present a dialog and that's to embed some form of plugin like silverlight, flash or an active x control in the page content then on load have it load itself.
If my understanding of your situation is correct you are trying to load possibly an active x control and for somme reason this active x control loads but is blank (so it's not loaded really).
Usual suspects here are down to registration of the activex component and security.
Of course i'm simply guessing that this is an active x issue.
Simply put ...
opening a dialog on a web page is as simple as ...
<script>
Alert("Hello world !!!");
</script>
If you want to take that further you will either need to render your dialog as html content or learn a few magic tricks with javascript.
how you would integrate that inn to your little framework ... that's a whole other story. Since your code is a dll, you can refer to it easily enough.
Maybe in your GetwebDialog() method (or whatever you call it) you can pass it the element or control on the page that you want your dialog emebedded in to then simply add a new user control instance to it.
Seems like the safest / cleanest way to go to me.
An easy way to do it is the JQuery dialog plugin. It has a modal property, if set to true will grey out the underlying web page and make the dialog a modal pop up.
This is how I do it:
protected void DisplayAlert(string message)
{
ClientScript.RegisterStartupScript(this.GetType(), Guid.NewGuid().ToString(), string.Format("alert('{0}');", message.Replace("'", @"\'")), true);
}
Thanks for the help, but I was more in the line of creating controls dynamically. I did this to solve my problem. I create a control on the fly (from Infragistics suite) and add it to the page Form, this works perfectly and from a separate DLL.
精彩评论