|
No.. it is only web control, but there are similar controls for windows apps at codeproject.
|
|
|
|
|
Is there anyway I can just display the "Info Window", without displaying the IM Window?
How can I do that from code?
|
|
|
|
|
Hi,
as mentioned, great job indeed.
can this control be used to open a pop-up message when the user enter the page, and not by an explicit clicking ?
or would it be blocked by SP2 / any other pop-up blocker?
thanks,
DaberElay
|
|
|
|
|
Hi first of all, your POPUP control is great... it gave me more flexibility being new in programming world... Just one question... is there's a way that the position where the window will pop-up can be variable? so that I can use it as my pop-up menu? means, I can have it pop-out anywhere in the screen...
thanks....
|
|
|
|
|
Hi Tomas,
First of all I’d like to congratulate you for creating such as cool control! I'm newbie to ASP.NET and still learning it.
I saw the testing page for the PopUp and I am really impressed. The only thing I wonder is that do you need to write any client-side JavaScript to produce the PopUp? Or you just need to write C# code on the server and .NET handles the client-side script issues automatically?
Thanks in advance,
David
|
|
|
|
|
There is plenty of JavaScript in source
But the cool thing about Asp.Net is, that nobody who wants to use control like this must care about this (generated) javascript.
|
|
|
|
|
Thanks for the reply!
Yes I also thought you needed JavaScript . But you're right that users don't have to worry about it.
Maybe in the future ASP.NET will generate client-side code automatically?
|
|
|
|
|
hi,
can i call this popup through javascript?
Thanks,
MANOJ
|
|
|
|
|
hi,
can i call this popup through javascript? please reply me to manoj22184@gmail.com
Thanks,
MANOJ
|
|
|
|
|
First, I want to express my appreciation of Tomas Petricek's work. He did a very good job.
Second, I modified the code to fit my needs, and I want to share it with everyone who is interested in it. I did two things:
1) Popup the window on top with left and right options.
2) Popup the message window in the middle of window.
The followings are changes to be made:
1) PopupDocking
2) Render()
3) function [id]espopup_ShowWindow()
The code is below: (Just copy and paste)
public enum PopupDocking
{
#region Members
/// Control is docked to left and bottom
BottomLeft,
/// Control is docked to right and bottom
BottomRight,
/// Control is docked to left and top By Bing 08/23/04
TopLeft,
/// Control is docked to right and top By Bing 08/23/04
TopRight
#endregion
}
protected override void Render(HtmlTextWriter output)
{
string br=Page.Request.Browser.Browser;
string script=sScript,sps=spopStyle;
string acmd="";
switch(popAction)
{
case PopupAction.MessageWindow:
acmd=aCommands.Replace("[cmd]","javascript:[id]espopup_ShowWindow();");
script=script.Replace("[slink]","");
script=script.Replace("[sclose]","");
break;
case PopupAction.RaiseEvents:
acmd=aCommands.Replace("[cmd]","javascript:[id]espopup_ShowWindow();");
string scriptClick=(LinkClicked==null)?"":
(Page.GetPostBackClientEvent(this,"C")+"; return;");
string scriptClose=(PopupClosed==null)?"":
(Page.GetPostBackClientEvent(this,"X")+"; return;");
script=script.Replace("[slink]",scriptClick);
script=script.Replace("[sclose]",scriptClose);
break;
case PopupAction.OpenLink:
acmd=aCommands.Replace("[cmd]",sLink);
script=script.Replace("[slink]","");
script=script.Replace("[sclose]","");
if (sTarget!="") acmd+=" target=\""+sTarget+"\"";
break;
}
sps=sps.Replace("[gs]",gradientStart);
sps=sps.Replace("[ge]",gradientEnd);
sps=sps.Replace("[clr]",textColor);
script=script.Replace("[winstyle]",String.Format(
"width={0},height={1},scrollbars={2}",winSize.Width,
winSize.Height,(winScroll?"yes":"no")));
script=script.Replace("[hide]",iHide.ToString());
script=script.Replace("[stime]",startTime.ToString());
script=script.Replace("[id]",ClientID);
script=script.Replace("[ie]",(br=="IE"?"true":"false"));
script=script.Replace("[popup]",String.Format(sPopup,fullmsg,title,sps));
script=script.Replace("[autoshow]",bAutoShow.ToString().ToLower());
script=script.Replace("[speed]",iSpeed.ToString());
string divPos=String.Format("width:{0}; height:{1}; ",Width,Height);
string cntsI=String.Format(cntStyleI,Width.Value-6,Height.Value-24);
string cntsN=String.Format(cntStyleN,Width.Value-10,Height.Value-28);
string sLocation = ""; ///Bing 08/23/04
string sDragDrop="";
if (bDragDrop)
sDragDrop=" onmousedown=\"return "+ClientID+"espopup_DragDrop(event);\" ";
/// ---- Added by Bing 08/23/04
switch(popDock)
{
case PopupDocking.BottomLeft:
divPos+="left:";
sLocation = "bottom";
break;
case PopupDocking.BottomRight:
divPos+="right:";
sLocation = "bottom";
break;
case PopupDocking.TopLeft:
divPos+="left:";
sLocation = "top";
break;
case PopupDocking.TopRight:
divPos+="right:";
sLocation = "top";
break;
}
divPos+=string.Format("{0}px; [position]:{1}px;",xOffset,yOffset);
divPos = divPos.Replace("[position]",sLocation);
/// ---- Added by Bing 08/23/04
output.Write(script+String.Format(""+
" {6} "+
" "+
((bShowLink==true)?
" {12} ":
"{12}"),
ClientID,PutColors(divDesign),divPos,ClientID+"_header",sDragDrop,PutColors(hdrStyle).
Replace("[wid]",(Width.Value-6).ToString())+PutColors(aStyle),
""+title+""+PutColors(closeHtml).Replace("[id]",ClientID),ClientID+"_content",
PutColors(cntStyle)+((br!="Netscape"&&br!="Mozilla")?cntsI:cntsN),PutColors(aStyle),
acmd.Replace("[id]",ClientID),ClientID+"aCnt",msg));
}
function [id]espopup_ShowWindow()
{
[slink]
var LeftPos = 300;
var TopPos = 300;
if ([id]nWin!=null) [id]nWin.close();
[id]nWin=window.open('','[id]nWin','[winstyle], '+
'menubar=no, resizable=no, status=no, toolbar=no, location=no, left='+LeftPos+',top='+TopPos);
[id]nWin.document.write([id]nText);
}
Bing Chen
|
|
|
|
|
Thanks for your contribution Bing!
|
|
|
|
|
I get an error in the editor when I paste in the:
output.Write(script+String.Format("
"+
"
{6}
"+
"
"+
((bShowLink==true)?
"{12}
":
"{12}
"),
Any ideas?
(I get all the squigly lines, I guess the line wrap is not accepted)
When I put it all on one line, i get weird rendering. All text. no boxes.
Thanks!
|
|
|
|
|
Hi guy;
The code I posted is the modules I modified. For better understanding, I give you everything. But if may confuse you.
Look at the block which I made a change to. -- look at this
/// ---- Added by Bing 08/23/04
Here is my code added/modified
/// ---- Added by Bing 08/23/04
For the rest part you sould not touch it. The code you showed me is his original code which I have never modified yet.
Put it in another way, you can compare my stuff with the original one and, copy and paste the changes I made. I think this way should work.
Bing
|
|
|
|
|
He did not check the HTML tag option when posting. Here is what is supposed to be.
output.Write(script+String.Format("<div id=\"{0}\" "+
"style=\"display:none; {1} {2}\" onselectstart=\"return false;\" {4}>"+
"<div id=\"{3}\" style=\"cursor:default; display:none; {5}\">{6}</div>"+
"<div id=\"{7}\" onmousedown=\"event.cancelBubble=true;\" style=\"display:none; {8}\">"+
((bShowLink==true)?
"<a style=\"{9}\" {10} id=\"{11}\">{12}</a></div></div>":
"<span style=\"{9}\" id=\"{11}\">{12}</span></div></div>"),
ClientID,PutColors(divDesign),divPos,ClientID+"_header",sDragDrop,PutColors(hdrStyle).
Replace("[wid]",(Width.Value-6).ToString())+PutColors(aStyle),
"<span id=\""+ClientID+"titleEl\">"+title+"</span>"+PutColors(closeHtml).Replace("[id]",ClientID),ClientID+"_content",
PutColors(cntStyle)+((br!="Netscape"&&br!="Mozilla")?cntsI:cntsN),PutColors(aStyle),
acmd.Replace("[id]",ClientID),ClientID+"aCnt",msg));
|
|
|
|
|
Hi Bing, Thanks for sharing your code.
I have copied and pasted your code to the PopupWIn.cs file and I have two questions that I might need your help:
1) what should I do to popup the message window in the middle of the window as you claimed?
2) When I changed the docking to TopLeft, the popup window will appear from TopLeft position with correct OffsetX. The OffsetY doesn't work though. The popup always fall down from the top regardless the OffsetY. Any idea?
KL
|
|
|
|
|
Hi, Kailing;
1) You can set OffsetX = 400 and OffsetY = 300 and use BottonRight instead of TopLeft. You will see the PopupWin to be displayed in the center of windows.
2) I added the code to display the Message windows in the center of windows too. see the following code. The message windows will be displayed when you click on the Text message inside the PopupWin.
I added: var LeftPos = 300;
var TopPos = 300;
function [id]espopup_ShowWindow()
{
[slink]
var LeftPos = 300;
var TopPos = 300;
if ([id]nWin!=null) [id]nWin.close();
[id]nWin=window.open('','[id]nWin','[winstyle], '+
'menubar=no, resizable=no, status=no, toolbar=no, location=no, left='+LeftPos+',top='+TopPos);
[id]nWin.document.write([id]nText);
}
For testing purpose, you can create a web form by adding one button and two Textboxes (txtX and txtY)
Put the following code in your button_click
private void Button1_Click(object sender, System.EventArgs e)
{
PopupWin1.Title = "My Title";
PopupWin1.Message = "My Message";
PopupWin1.Text = "My Text";
PopupWin1.Visible = true;
PopupWin1.OffsetX = Convert.ToUInt16(txtX.Text.ToString());
PopupWin1.OffsetY = Convert.ToUInt16( txtY.Text.ToString());
}
Run it and change the X and Y, then click on the button to experience the displaying of the PopupWin.
Hope that's enough to answer your questions.
Bing
|
|
|
|
|
Bing, Thanks for the response.
Unfortunately, it didn't help me a lot. What I really want is to display the PopupWin in the center of the window and make a change to what you have suggested (set OffsetX = 400 and OffsetY = 300 and use BottonRight) will only work if I have the browser window maximized (unless I missed something).
KaiLing
|
|
|
|
|
Kailing;
I know what you means. To display the PopupWin in the center of a window which is not maximized or resizable is not easy. I tried to create a javascript to get the center location which the PopupWin can use for display. It works fine. However, To incorporate it into the PopupWin is not a easy job. In other words, it easier said than done.
Take a close look at the popupWin.cs, you will know how it works. Thomas puts everything of javascript related codes into a string then calls Render(HtmlTextWriter output) to accomplish the cool popupwin. It is not simple to communicate between javascript (client side) and .NET (server side). The center of the PopupWin is dynamically changed or created at the runtime. It is contradict to the original design of popupWin. You can ask Thomas to do it as he is the designer.
The following is my testing code to make the popupWin in the center dynamically. If you are interested, please try it.
First, created two textboxes, which are from HTML, not from Web Form. You can make those hidden later.
Second, create a button as below:
private void Button1_Click(object sender, System.EventArgs e)
{
PopupWin1.Title=textTitle.Text;
PopupWin1.Message=textMsg.Text;
PopupWin1.Text=textText.Text;
// middle
string test = Request["X"];
string sLeftPos = X.Value;
int iPos = sLeftPos.IndexOf(".");
if (iPos > 0)
{
sLeftPos = sLeftPos.Substring(0,iPos);
}
string sTopPos = Y.Value;
iPos = sTopPos.IndexOf(".");
if (iPos > 0)
{
sTopPos = sTopPos.Substring(0,iPos);
}
long LeftPos = Convert.ToInt32(sLeftPos);
long TopPos = Convert.ToInt32(sTopPos);
PopupWin1.OffsetX = (int) (TopPos); //LeftPos
PopupWin1.OffsetY = (int) (LeftPos); // TopPos
// middle
}
Third, go back to HTML add the following code:
function SetToMiddle()
{
var w = 480, h = 340;
if (document.all)
{
w = document.body.clientWidth;
h = document.body.clientHeight;
}
var popW = 200, popH = 100;
var leftPos = (w-popW)/2, TopPos = (h-popH)/2;
document.Form1.X.value = TopPos;
document.Form1.Y.value = leftPos;
// document.forms[0].PopupWin.OffsetX = TopPos;
// document.forms[0].PopupWin.OffsetY = leftPos;
//confirm("OK...");
}
Fourth, make the like that:
Fifth, make the PopupWin1's DocMode = BottomRight.
Run it and change the window size as you will then click on the button to see if the PopupWin is appearing in the center or not.
Bing
|
|
|
|
|
I downloaded the files from the site and tried opening the VBNet version.
First off, i had to create a folder EeekSoft.PopupTest and inside of this i included the VBNet Folder. I also created a Folder called EeekSoft.Web where I pasted the EeekSoft.Web.PopupWin.dll ... i tried compiling but i keep on getting the Error : Name 'EeekSoft' is not declared.
This happens everywhere where there is a call to the name EeekSoft ... for example, EeekSoft.Web.PopupColorStyle.Blue ...
Well i am new to the .net stuff and from the little i remember reading somewhere i am supposed to include all my dll files for controlls in the bin directory within my project right ??? but since the calls are all Eeeksoft.Web i just assumed that i had to create a folder with that name ...
I am also aware that i should somehow import this namespace but i am not sure what going here ... please if you have successfull ran the VBNet project please give some hints/suggestions as to what i am doing wrong ... thanks and i will anxiously be waiting for some reply ...
|
|
|
|
|
Really cool control!!!
But i REALLY need it to fall down instead of "falling up"!
I'm sitting here looking through the javascript in the code, but i can't figure out how to make it change direction.
Could you help??
regards
Andreas Moeller
|
|
|
|
|
Hi,
My form has a few buttons processing user input, thus it postbacks a few times. This means that the popupWin pops up each time I hit one of these buttons.
My code is something like
Part 1
<button1>
Part 2
<button2>
...
Part n
The reason why I use many buttons because I want the users see the result right away regard to the task they just did instead of waiting to finish everything.
So to stop popupWin from showup everytime, I must get rid all but on of my controls which postback or is there a way to fix this problem? I just want to inform users of the ambiguous actions they perform.
Thank you very much.
|
|
|
|
|
Put this lines in your page_load
If IsPostBack Then
PopupWin1.Visible = False
End If
now, the popupwin won´t show every postback
|
|
|
|
|
This control is awesome and very close to what I need. I'm looking for something that will pop up a window with details when a mouse is over an image. This control works great for that. It needs to disappear when the mouse is no long over the image, but I believe and can handle adding that.
What's killing me is using it inside of user controls. I need it to be inside of a .ascx because I'm using datalist and need each item in the ItemTemplate to have an image with an associated PopupWindow. Even with just one item and no datalist, I can't get it to work when I use a user control.
I have a user control that creates everything at run time so I can specify the client ID. It works fine in an .aspx page but dies in the .ascx. Here's what in the Page_Load.
----------------------
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim MyPopup As New PopupWin
Dim MyAnchor As New PopupWinAnchor
' Set Anchor properties
MyAnchor.PopupToShow = MyPopup.ClientID
MyAnchor.LinkedControl = ImageButton1.ClientID
MyAnchor.HandledEvent = "onmouseover"
MyAnchor.ID = "anchor_ImageButton1"
' Set popup properties
MyPopup.ActionType = PopupAction.MessageWindow
MyPopup.Title = "This is a hand made popup"
MyPopup.Message = "Message displayed in popup"
MyPopup.Text = "Text to show in new window.."
MyPopup.HideAfter = 7000
MyPopup.ID = "popup_ImageButton1"
' Show popup
MyPopup.Visible = True
MyPopup.AutoShow = True
PlaceHolder1.Controls.Add(MyPopup)
PlaceHolder1.Controls.Add(MyAnchor)
End Sub
----------------------
It's saying "expected object". Any ideas on what's different using a UserControl?
Thanks,
John
|
|
|
|
|
Hi,
I'm sorry for my slow response (I hope I'll find enough time to do some bigger modifications on popup control some time..).
I think, that problem is in PopupWinAnchor, where ID property is used instead of ClientID , so it generates wrong script. Try replacing ID in Render method of PopupWinAnchor class with ClientID ..
|
|
|
|
|
This is a great control that Tomas did, but there is another approach that might serve john's purpose better, it's called overlib and it is designed to create popup windows when you move your mouse over an image or hyperlink or button.
overlib's url is http://www.bosrup.com/web/overlib/[^]
Overlib is not a .net control, but you can easily include it in your application like I did, you can see it running in an asp.net app on http://demo.belenox.com/login.aspx[^]
you can Login to this online demo of one of my applications as admin / admin
and see overlib in action
I would use Popupwindow passively, notifying users of new events without them having to click on anything, like new posts in the forums, trouble tickets status changed, etc...
and I use overlib actively to help the user navigate a list of messages, display item details, preview pictures or text etc...
Let me know if you need examples to feed the data to the controls dynamically.
Hope this helps!
Talal Nehme
mi4.com
|
|
|
|
|