I'm using a web service to retrieve some dynamically formatted HTML and currently creates a javascript popup window to render the HTML. How can I do something similar with the Coolite Window control.
Thanks,
Brian
Printable View
I'm using a web service to retrieve some dynamically formatted HTML and currently creates a javascript popup window to render the HTML. How can I do something similar with the Coolite Window control.
Thanks,
Brian
Hi Brian,
Just wondering if you can post some code to demonstrate how you are doing this currently? From there, it should be fairly easy to port that to use an <ext:Window>
I'm making an directory of all employee's within my company using a dynamically created label and pulling position from a sql db to simulate employee office locations. I also add to that a onclick calling call_getdata.js. The call to the javascript goes out to the "EmployeeDirectory_v2.DL.srv_GetData.GetData" web service. Currently the javascript calls another javascript to create a popup window. Using the webservice I return "HTML" and inject it into the "succeededcallback" function which renders the popup and I get a nice little popup window displaying the details of an employee. I wish to use the coolite window instead and in future use the v.5 tools as well.....
Thanks
Code:
//BEGIN default.aspx
//here is a sample of how I create the label and set there locations and click event
For i = 0 To NumPoints - 1
lbl = New Label()
lbl.Text = empName(i)
'lbl. = ID(i)
lbl.Width = sX(i).ToString
lbl.Height = sY(i).ToString
lbl.Attributes.Item("style") = "cursor: pointer; text-align: center; font-size: x-small; font-family: Verdana; LEFT: " & cX(i) & "px; POSITION: absolute; TOP: " & cY(i) & "px"
lbl.Attributes.Add("ID", ID(i))
lbl.Attributes.Item("onclick") = "GetContent(" & ID(i) & ");"
PlaceHolder1.Controls.Add(lbl)
'Dim spacer As LiteralControl = New LiteralControl("<br>")
'PlaceHolder1.Controls.Add(spacer)
Next i//END-------------------------------------------------------
//BEGIN------------------------------------------------------------------
//call_getdata.js
//I call this Javascript in an onclick event from a label
function GetContent(x)
{
EmployeeDirectory_v2.DL.srv_GetData.GetData(x, SucceededCallback);
}
function SucceededCallback(result, eventArgs)
{
//Page element to display feedback.
xWindowContent = result;
if (xWindowContent.match("xxx0"))
{
winnum = winnum + 1
if(winnum == 1){
xWindowContent = xWindowContent.replace(/xxx0/,"");
createNewWindow(330,236,454,380,xWindowContent);
}
else
{
xWindowContent = xWindowContent.replace(/xxx0/,"");
document.getElementById("dhtml_goodies_id" + divCounter).style.display='none';
createNewWindow(330,236,454,380,xWindowContent);
}
}
else
{
winnum = winnum + 1
if(winnum == 1){
xWindowContent = xWindowContent.replace(/xxx8/,"");
createNewWindow(330,320,454,380,xWindowContent);
}
else
{
xWindowContent = xWindowContent.replace(/xxx8/,"");
document.getElementById("dhtml_goodies_id" + divCounter).style.display='none';
createNewWindow(330,320,454,380,xWindowContent);
}
}
;
}
if (typeof(Sys) !== "undefined") Sys.Application.notifyScriptLoaded();//END--------------------------------------------------
//BEGIN----------------------------------------------
//webservice
Imports KSMEmployeeDirectory_v2.BL.scripts
Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Web.Script.Services
Imports System.Web.Configuration
Imports System.ComponentModel
Namespace DL
<WebService(Namespace:="KSMEmployeeDirectory_v2.DL.srv_GetData")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ScriptService()> _
Public Class srv_GetData
Inherits System.Web.Services.WebService
<WebMethod()> _
Public Function GetData(ByVal wID As String) As String
'Dim SQL As New SqlDataSource
'SQL.ConnectionString = ConfigurationManager.ConnectionStrings("KSMPCInventoryConnectionString2").ToString
'SQL.SelectCommand = "SELECT PC_info.Model, PC_info.CPU, PC_info.Memory, PC_info.FloppyDrive, PC_info.HardDrive, PC_info.Video, PC_info.DualMonitor, PC_info.ServiceTag, PC_info.ExpressServ, PC_info.Warranty, PC_info.SpecialUse, Matchup.workspaceid, Workspace.GenLoc, Workspace.PhoneExt, Workspace.DataPort1, Matchup.empid, Matchup.PcNumber, LTRIM(RTRIM(KSM.dbo.Employee.Empfname)) + ' ' + KSM.dbo.Employee.Emplname AS empname, PC_info.PcNotes, KSM.dbo.vExtension.EmpCustValue AS Extension, PC_info.UserStamp, PC_info.Type, PC_info.MonitorCount, KSM.dbo.Employee.Empdept, CONVERT (varchar(12), KSM.dbo.Employee.Emphire, 101) AS startdate, KSM.dbo.Employee.Empstatus, KSM.dbo.Employee.Empphone1 AS HomePhone, KSM.dbo.Employee.Empphone2 AS cell, KSM.dbo.Employee.Empnum, KSM.dbo.Department.DeptName, LEFT (LTRIM(RTRIM(KSM.dbo.Employee.Empfname)), 1) + LTRIM(RTRIM(KSM.dbo.Employee.Emplname)) + KSM.dbo.Employee.Empnum + '.jpg' AS EmpPic, KSM.dbo.Employee.EmpEmail, KSM.dbo.vOfficeFax.EmpCustValue AS fax, KSM.dbo.vEmpSchool.EmpCustValue AS School, LTRIM(RTRIM(KSM.dbo.Employee.Empfname)) AS FirstName, KSM.dbo.Employee.Emplname AS LastName, KSM.dbo.vEmpSpecialty.EmpCustValue AS Specialty, KSM.dbo.SkillLevel.SkDesc AS Partner, KSM.dbo.Employee.Empcity AS City, KSM.dbo.Employee.Empaddr1 AS Address, KSM.dbo.Employee.Empst AS State, KSM.dbo.Employee.Empzip AS Zip, KSM.dbo.vSpouse.EmpCustValue AS Spouse, Workspace.WorkspaceJacks FROM KSM.dbo.SkillLevel RIGHT OUTER JOIN KSM.dbo.Employee ON KSM.dbo.SkillLevel.SkID = KSM.dbo.Employee.Emplevel LEFT OUTER JOIN KSM.dbo.vEmpSchool ON KSM.dbo.Employee.ID = KSM.dbo.vEmpSchool.EmpCustEmpId LEFT OUTER JOIN KSM.dbo.vOfficeFax ON KSM.dbo.Employee.ID = KSM.dbo.vOfficeFax.EmpCustEmpId RIGHT OUTER JOIN KSM.dbo.Department ON KSM.dbo.Employee.Empdept = KSM.dbo.Department.DeptID LEFT OUTER JOIN KSM.dbo.vExtension ON KSM.dbo.Employee.ID = KSM.dbo.vExtension.EmpCustEmpId LEFT OUTER JOIN Workspace RIGHT OUTER JOIN Matchup ON Workspace.Workspaceid = Matchup.workspaceid RIGHT OUTER JOIN PC_info ON Matchup.PcNumber = PC_info.PCNumber ON KSM.dbo.Employee.ID = Matchup.empid LEFT OUTER JOIN KSM.dbo.vEmpSpecialty ON KSM.dbo.Employee.ID = KSM.dbo.vEmpSpecialty.EmpCustEmpId LEFT OUTER JOIN KSM.dbo.vSpouse ON KSM.dbo.Employee.ID = KSM.dbo.vSpouse.EmpCustId WHERE (Matchup.workspaceid = " & contextKey & ")"
Dim KSMInventoryConnectionString As String = WebConfigurationManager.ConnectionStrings("KSMEmployeeDirectory_v2.My.MySettings.sql_empdir").ToString
Dim cnSQL As Data.SqlClient.SqlConnection
Dim prmSQL As Data.SqlClient.SqlParameter
Dim drSQL As Data.SqlClient.SqlDataReader
Dim cmdSQL As Data.SqlClient.SqlCommand
''Employee Information
Dim empname As String = ""
Dim DeptName As String = ""
Dim emppic As String = ""
Dim Specialty As String = ""
Dim EmpEmail As String = ""
Dim hmnum As String = ""
Dim wkext As String = ""
Dim cellnum As String = ""
Dim faxnum As String = ""
Dim Address As String = ""
Dim City As String = ""
Dim State As String = ""
Dim Zip As String = " "
Dim startdate As String = ""
Dim School As String = ""
''IS Information
Dim PCNumber As String = ""
Dim Model As String = ""
Dim ServiceTag As String = ""
Dim jackID As String = ""
Dim Warranty As String = ""
cnSQL = New Data.SqlClient.SqlConnection(KSMInventoryConnectionString)
cnSQL.Open()
cmdSQL = New Data.SqlClient.SqlCommand("GET_EmpDirData", cnSQL)
With cmdSQL
.CommandTimeout = 60
.CommandType = Data.CommandType.StoredProcedure
prmSQL = .Parameters.Add("wID", Data.SqlDbType.Int)
prmSQL.Value = wID
drSQL = .ExecuteReader
Do While drSQL.Read()
''Employee Information
empname = drSQL("empname") & " "
DeptName = drSQL("DeptName") & " "
emppic = drSQL("emppic") & " "
Specialty = drSQL("Specialty") & " "
EmpEmail = drSQL("EmpEmail") & " "
hmnum = drSQL("hmnum") & " "
wkext = drSQL("wkext") & " "
cellnum = drSQL("cellnum") & " "
faxnum = drSQL("faxnum") & " "
Address = drSQL("Address") & " "
City = drSQL("City") & " "
State = drSQL("State") & " "
Zip = drSQL("Zip") & " "
startdate = drSQL("startdate") & " "
School = drSQL("School") & " "
''IS Information
PCNumber = drSQL("pcnumber")
Model = drSQL("Model")
ServiceTag = drSQL("servicetag")
jackID = drSQL("jackID")
Warranty = drSQL("warranty")
drSQL.NextResult()
Loop
drSQL.Close()
End With
cmdSQL = Nothing
cnSQL.Close()
cnSQL.Dispose()
Dim userid As Integer = GetUserID()
Dim SysAdminLevel As String = GetPermission(userid, "IsDept")
Dim x As String
If SysAdminLevel >= "0" And SysAdminLevel < "8" Then
x = "xxx" & SysAdminLevel & _
"<table id='tbl_EmpDetails' width='280' border='0' cellpadding='0' cellspacing='0' style=';BORDER-RIGHT: navy 0px solid; BORDER-TOP: navy 1px solid; BORDER-LEFT: navy 1px solid; BORDER-BOTTOM: navy 0px solid;background-color: LightSteelBlue; background-image: url(images/New_Table_flattened.jpg);'>" & _
"<tr><td colspan='3' width='150' height='33'>&nbsp;" & _
empname & "</td><td colspan='4' width='200' height='33'>" & _
empname & "</td></tr><tr><td style='background-image: url(images/EmpPicBg.gif);background-repeat: no-repeat;background-color:white;'rowspan='10' width='150' height='160'><img id='img_EmpDetails01' src='EmpPics\" & _
emppic & "'" & "style='border-color:DarkOrange;border-width:2px;border-style:solid;width:140px;' /></td><td colspan='6' width='164' height='25' valign='top'>&nbsp;&nbsp;&nbsp;" & _
DeptName & "</td></tr><tr><td colspan='6' width='164' style='height: 15px'>&nbsp;&nbsp;&nbsp;" & _
"<a href='mailto:" & EmpEmail & "'>" & EmpEmail & "</td></tr><tr style='background-color:white;'><td width='40' height='15'>&nbsp;&nbsp;&nbsp;Ext:</td><td colspan='5' width='124' height='15'>" & _
wkext & "</td></tr><tr><td width='40' height='15'>&nbsp;&nbsp;&nbsp;Cell:</td><td colspan='5' width='124' height='15'>" & _
cellnum & "</td></tr><tr style='background-color:white;'><td width='40' height='15'>&nbsp;&nbsp;&nbsp;Fax:</td><td colspan='5' width='124' height='15'>" & _
faxnum & "</td></tr><tr><td width='40' height='15'>&nbsp;&nbsp;&nbsp;Hm:</td><td colspan='5' width='124' height='15'>" & _
hmnum & "</td></tr><tr style='background-color:white;'><td colspan='6' width='164' height='15'>&nbsp;&nbsp;&nbsp;" & _
Address & "</td></tr><tr style='background-color:white;'><td colspan='4' width='85' height='15'>&nbsp;&nbsp;&nbsp;" & _
City & "</td><td height='15' style='width: 15px'>" & _
State & "</td><td width='15' height='15'>" & _
Zip & "</td></tr><tr><td colspan='3' height='15' style='width: 15px'>" & _
"&nbsp;&nbsp;&nbsp;Start Date:</td><td colspan='3' height='15' style='width: 76px'>" & _
startdate & "</td></tr><tr style='background-color:white;'><td colspan='6' width='164' height='15'>&nbsp;&nbsp;&nbsp;" & _
School & "</td></tr><tr><td colspan='7' width='350' height='17'>&nbsp;&nbsp;&nbsp;" & _
Specialty & "</td></tr></table>"
Else
'with permission
x = "xxx" & SysAdminLevel & _
"<table id='FVEmp_geez' width='330' border='0' cellpadding='0' cellspacing='0' style=';BORDER-RIGHT: navy 0px solid; BORDER-TOP: navy 1px solid; BORDER-LEFT: navy 1px solid; BORDER-BOTTOM: navy 0px solid;background-color: LightSteelBlue; background-image: url(images/New_Table_flattened.jpg);'>" & _
"<tr><td colspan='3' width='150' height='33'>&nbsp;" & _
empname & "</td><td colspan='4' width='200' height='33'>" & _
empname & "</td></tr><tr><td style='background-image:url(images/EmpPicBg.gif);background-repeat: no-repeat;background-color:white;'rowspan='10' width='150' height='160'><img id='FV109_ImgEmp' src='EmpPics\" & _
emppic & "'" & "style='border-color:DarkOrange;border-width:2px;border-style:solid;width:140px;' /></td><td colspan='6' width='164' height='25' valign='top'>&nbsp;&nbsp;&nbsp;" & _
DeptName & "</td></tr><tr><td colspan='6' width='164' style='height: 15px'>&nbsp;&nbsp;&nbsp;" & _
"<a href='mailto:" & EmpEmail & "'>" & EmpEmail & "</td></tr><tr style='background-color:white;'><td width='40' height='15'>&nbsp;&nbsp;&nbsp;Ext:</td><td colspan='5' width='124' height='15'>" & _
wkext & "</td></tr><tr><td width='40' height='15'>&nbsp;&nbsp;&nbsp;Cell:</td><td colspan='5' width='124' height='15'>" & _
cellnum & "</td></tr><tr style='background-color:white;'><td width='40' height='15'>&nbsp;&nbsp;&nbsp;Fax:</td><td colspan='5' width='124' height='15'>" & _
faxnum & "</td></tr><tr><td width='40' height='15'>&nbsp;&nbsp;&nbsp;Hm:</td><td colspan='5' width='124' height='15'>" & _
hmnum & "</td></tr><tr style='background-color:white;'><td colspan='6' width='164' height='15'>&nbsp;&nbsp;&nbsp;" & _
Address & "</td></tr><tr style='background-color:white;'><td colspan='4' width='85' height='15'>&nbsp;&nbsp;&nbsp;" & _
City & "</td><td height='15' style='width: 15px'>" & _
State & "</td><td width='15' height='15'>" & _
Zip & "</td></tr><tr><td colspan='3' height='15' style='width: 15px'>" & _
"&nbsp;&nbsp;&nbsp;Start Date:</td><td colspan='3' height='15' style='width: 76px'>" & _
startdate & "</td></tr><tr style='background-color:white;'><td colspan='6' width='164' height='15'>&nbsp;&nbsp;&nbsp;" & _
School & "</td></tr><tr><td colspan='7' width='314' height='17'>&nbsp;&nbsp;&nbsp;" & _
Specialty & "</td></tr></table>" & _
"<table id='FVEmp_geez' width='100%' border='0' cellpadding='0' cellspacing='0' style='background-image: url(images/lightblue.gif);background-color: LightSteelBlue;'>" & _
"<tr style='background-color:DarkOrange;'><td colspan='2' style='height: 15px'>&nbsp;&nbsp;&nbsp;" & _
"IS Information</td></tr><tr style='background-color:white;'><td height='15'>&nbsp;&nbsp;&nbsp;" & _
Model & "</td><td height='15'>" & _
"Connect to:&nbsp;&nbsp;&nbsp;<a href='http://ksm16/ksminventory/vnc2.aspx?PCNumber=" & PCNumber & "' " & ">" & PCNumber & "</td></tr><tr><td height='15'>&nbsp;&nbsp;&nbsp;Service Tag:&nbsp;&nbsp;&nbsp;" & _
ServiceTag & "</td><td height='15'>" & _
"Workspace Jack:&nbsp;&nbsp;&nbsp;" & _
jackID & "</td></tr><tr style='background-color:white;'><td height='15'>" & _
"&nbsp;&nbsp;&nbsp;Warranty exp:&nbsp;&nbsp;&nbsp;" & Warranty & "</td><td height='15'>" & _
"Inventory for:&nbsp;&nbsp;&nbsp;<a href='http://ksm16/ksminventory/ViewAllPcs2.aspx?Selectedpc=" & PCNumber & "' target='_blank'>" & PCNumber & "</td></tr><tr><td>&nbsp;&nbsp;&nbsp;WkspID:&nbsp;&nbsp;&nbsp;" & wID & "</td></tr></table>"
End If
Return x
End Function
End Class
End Namespace
//END----------------------------------------------------------------------
You're going to have to scale back that sample a bit. It takes an enourmous amount of time to try and piece together what's happening on that page and I was not able to get something working. If you have a sample a "little more to the point", I'm sure I can post a working solution.
As a general rule of thumb, if forum members can simplify a sample/problem down to one self contained .aspx that we can quickly load into a testing project/site, you will get a detailed and quick response. The more time it takes for us to try to "figure out" and deconstruct a code sample, the less likely it will be that we can respond quickly.
Personally, I also prefer when the server-side code is placed at the top of the same page, instead of in a separate code-behind or partial class. Including everything in one file just simplifies the process and keeps everything together.
Example
Code:<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
this.Label1.Text = "This is a simple Page Template";
}
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Simple Page Template</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="Label1" runat="server" />
</form>
</body>
</html>
I thought that was alot of code for what I think is probably a simple solution. Basically I'm just trying to use a popup window and a webservice. I would like to eliminate a window rendered by javascript and focus more on your control. That large amount of code is what it took me just to have a popup window display data. I think with coolite popup not only am I eliminating the excessive code but I'm putting control back into Visual Studio. I you have a quick example how you would combine a web service and the window control I think this would allow my to figure out the rest. Sorry for the huge amount of code!
P.S. The webservice is basically a SQL adapter that fires a Stored Procedure and return data. The way that data is handled when "posting back" to the page is what I'm stuck on the most.
Was my simplification of code still unacceptable...I don't need any specific examples or alot of time devoted to this solution. With a good direction I can figure it out.
Thanks again!
Brian