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
//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----------------------------------------------------------------------