teclioness
Programmer
Hi,
I am making a web applications, where the users can post new messages for everyone to see (in their department). Every one minute the show messages page checks for new message and needs to show popup window with some part of the new message that has been posted.
I have been able to show one popup window using response.write method and writing javascript window.open code in it. Even the RegisterStartupScript method works fine.
The problem is if in case there are 2 or more messages being posted in that 1 minute time, I need to show multiple popup windows. How can I do that?
code is as follows, which I am running in a loop:
Dim strWinName As String = "win"
Dim intWin As Integer = Request.QueryString("id")
Dim strConcatWinName As String = strWinName + CStr(intWin)
Dim strMessText As New StringBuilder
strMessText.Append(strConcatWinName + ".document.write('<html><head><title>New message notification!!</title>');")
strMessText.Append(strConcatWinName + ".document.write('<link rel=""stylesheet"" href=""../styles/style.css"">');")
strMessText.Append(strConcatWinName + ".document.write('</head><body onBlur=""self.focus()"">');")
strMessText.Append(strConcatWinName + ".document.write('<p>Hello test</p>');")
strMessText.Append(strConcatWinName + ".document.write('<p>" + strConcatWinName).Append("</p>');")
strMessText.Append(strConcatWinName + ".document.write('<p>Close the popup.</p>');")
strMessText.Append(strConcatWinName + ".document.write('</body></html>');")
strMessText.Append(strConcatWinName + ".document.close();")
Dim strPopUp As New StringBuilder
strPopUp.Append("<script language='javascript'><!--" + Chr(10) + Chr(13))
strPopUp.Append("var w = 480, h = 340; var popW = 500, popH = 400;")
strPopUp.Append("var leftPos = (w-popW)/2, topPos = (h-popH)/2;")
strPopUp.Append("var strFeatures = ""titlebar=no,toolbar=no,resizable=yes,status=yes,me nubar=no,scrollbars=yes, left="" + leftPos + "",top=""+ topPos;")
strPopUp.Append("strFeatures = strFeatures + "", width="" + popW + "",height="" + popH;")
strPopUp.Append(strConcatWinName + " = window.open('', ""win"", strFeatures);")
strPopUp.Append(strMessText.ToString)
strPopUp.Append(strConcatWinName + ".focus();" + Chr(10) + Chr(13))
strPopUp.Append("//--></script>")
Response.Write(strPopUp.ToString)
I am making a web applications, where the users can post new messages for everyone to see (in their department). Every one minute the show messages page checks for new message and needs to show popup window with some part of the new message that has been posted.
I have been able to show one popup window using response.write method and writing javascript window.open code in it. Even the RegisterStartupScript method works fine.
The problem is if in case there are 2 or more messages being posted in that 1 minute time, I need to show multiple popup windows. How can I do that?
code is as follows, which I am running in a loop:
Dim strWinName As String = "win"
Dim intWin As Integer = Request.QueryString("id")
Dim strConcatWinName As String = strWinName + CStr(intWin)
Dim strMessText As New StringBuilder
strMessText.Append(strConcatWinName + ".document.write('<html><head><title>New message notification!!</title>');")
strMessText.Append(strConcatWinName + ".document.write('<link rel=""stylesheet"" href=""../styles/style.css"">');")
strMessText.Append(strConcatWinName + ".document.write('</head><body onBlur=""self.focus()"">');")
strMessText.Append(strConcatWinName + ".document.write('<p>Hello test</p>');")
strMessText.Append(strConcatWinName + ".document.write('<p>" + strConcatWinName).Append("</p>');")
strMessText.Append(strConcatWinName + ".document.write('<p>Close the popup.</p>');")
strMessText.Append(strConcatWinName + ".document.write('</body></html>');")
strMessText.Append(strConcatWinName + ".document.close();")
Dim strPopUp As New StringBuilder
strPopUp.Append("<script language='javascript'><!--" + Chr(10) + Chr(13))
strPopUp.Append("var w = 480, h = 340; var popW = 500, popH = 400;")
strPopUp.Append("var leftPos = (w-popW)/2, topPos = (h-popH)/2;")
strPopUp.Append("var strFeatures = ""titlebar=no,toolbar=no,resizable=yes,status=yes,me nubar=no,scrollbars=yes, left="" + leftPos + "",top=""+ topPos;")
strPopUp.Append("strFeatures = strFeatures + "", width="" + popW + "",height="" + popH;")
strPopUp.Append(strConcatWinName + " = window.open('', ""win"", strFeatures);")
strPopUp.Append(strMessText.ToString)
strPopUp.Append(strConcatWinName + ".focus();" + Chr(10) + Chr(13))
strPopUp.Append("//--></script>")
Response.Write(strPopUp.ToString)