|
I would be nice to have the javascript prompt as part of this control. Wouldn't it?
|
|
|
|
|
Hi!
All I want to do is have a "Record Updated!" message pop up in a window for a few seconds when the user clicks the Submit button on my web form.
I've added the popup control to the form and I've made visible = false in the page init subroutine. Then, when the user clicks the submit button, the first thing I do in the button click event is set visible to true for the popup control. It should display my message but it isn't.
Before I set visible = false in the page init, the popup was displaying when the form opened, so I know the popup will display. I just can't seem to get it to display in the submit button click event.
Is there something more I need to do? Do I need to modify some of the code in the HTML portion of the web form rather than in the CodeBehind? Please advise. This is really urgent, please. I have to get this project done and this message is one of the last pieces I needed to add for them.
Thank you!
Karen Grube
klgrube@yahoo.com
|
|
|
|
|
Hi,
i think that you are doing everything correctly and i don't know what may be wrong . Try looking at demo project. It contains similar piece of code, so maybe you can find some defference there.
Another thing you can check is if control generates Javascript code after setting Visible=true. If it does, try to check if all numbers (like ShowAfter).
If you want more help please send me a link of your application, so I can look what may be wrong.
|
|
|
|
|
Thx for this amazing control!
|
|
|
|
|
this control is posible use in a windows aplication?
MIRo
|
|
|
|
|
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
|
|
|
|
|