2/21/2025 5:00:56 AM
|
|
slxdeveloper.com Community Forums |
|
|
|
The Forums on slxdeveloper.com are now retired. The forum archive will remain available for the time being. Thank you for your participation on slxdeveloper.com!
Forum to discuss using & developing the legacy SalesLogix Web Client (For versions 7.0 and earlier). View the code of conduct for posting guidelines.
|
|
|
| |
|
Re: Tree View in Web Client
Posted: 03 Oct 06 2:42 AM
|
fiogf49gjkf0d Hi Steve,
The treeview used by the GroupManger was built in ASP.NET, so my guess is you want to do the same. I do have some code which I will try and dig out. -- Duncan |
|
|
|
Re: Tree View in Web Client
Posted: 03 Oct 06 2:52 AM
|
fiogf49gjkf0d This is a very old bit of code used on ASP.NET v1.1 and not nessarcily the best way to do it, but it will still work For this I used the the obout tree control, allthough to be fair, you could use the default tree control
Add the namespace Import Namespace="obout_ASPTreeView_2_NET"
Then the Code: Sub Page_Load() Dim sParentID as String Dim conid as string conid = Request.QueryString("conid") Dim conname as string conname = Request.QueryString("conname") Dim ct as string = Request.QueryString("ct") Dim ca as string = Request.QueryString("ca") Dim cTitle as string Dim cAccount as string
Dim oReader as OleDbDataReader Dim oReader2 as OleDbDataReader Dim oTree As New obout_ASPTreeView_2_NET.Tree() oTree.FolderIcons = "/ASPNET/TreeIcons/Icons" oTree.FolderStyle = "/ASPNET/TreeIcons/Styles/Classic" oTree.AddRootNode(conname, "confolder.gif") oTree.ShowLostRed = true Dim Cn as OleDbConnection = new OleDbConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim bol as boolean bol = True Dim nIcon as String nIcon = "middle.gif" 'Add Root to oTree.Add("root", "id1", "Associations To:", bol, "top.gif") 'Add Root from oTree.Add("root", "id2", "Associations From:", bol, "top.gif") 'Add Root from oTree.Add("root", "id3", "Referrals:", bol, "opp.gif") 'Add Root from 'oTree.Add("root", "id4", "Marketing Campaigns:", bol, "cam.gif") 'Add Root from oTree.Add("root", "id5", "Events:", bol, "eve.gif") '---------------------------------------------------------------------------------------------------------------------------------- 'Populate to Relations '---------------------------------------------------------------------------------------------------------------------------------- Dim SQL2 as String = "select distinct(forwardrelation) from association where FROMID = '" & conid & "' and ACCOUNTASSOCIATION = 'F'" Dim Com2 as OleDbCommand = new OleDBCommand(SQL2,Cn) Cn.Open oReader2 = Com2.ExecuteReader() 'Add Forward Relationships Do While oReader2.Read() oTree.Add("id1", "id" & oReader2("forwardrelation"), "as " & oReader2("forwardrelation") & " of:", bol, nIcon) Loop oReader2.Close Cn.Close Dim SQL as String = "SELECT ASSOCIATION.FROMID AS PARENT, ASSOCIATION.TOID as TOID, ASSOCIATION.ASSOCIATIONID AS ID, ASSOCIATION.FORWARDRELATION AS HTML, " & _ "CONTACT.FIRSTNAME AS ToFirstname, CONTACT.LASTNAME AS ToLastname, CONTACT_1.LASTNAME AS FromLastname, " & _ "CONTACT_1.FIRSTNAME AS FromFirstname, ASSOCIATION.TOID, CONTACT.ACCOUNT as ToAccount, CONTACT.TITLE as ToTitle, CONTACT_1.ACCOUNT as FromAccount, CONTACT_1.TITLE as FromTitle " & _ "FROM ASSOCIATION INNER JOIN " & _ "CONTACT ON ASSOCIATION.FROMID = CONTACT.CONTACTID INNER JOIN " & _ "CONTACT CONTACT_1 ON ASSOCIATION.TOID = CONTACT_1.CONTACTID " & _ "WHERE(ASSOCIATION.FROMID = '" & conid & "') AND (ASSOCIATION.ACCOUNTASSOCIATION = 'F') " & _ "ORDER BY HTML" Dim Com as OleDbCommand = new OleDBCommand(SQL,Cn) Cn.Open oReader = Com.ExecuteReader() ' Populate TreeView in one loop. 'Add Accounts to Forward Relationships Do While oReader.Read() ID = ID + 1 If ct = "T" then cTitle = " - " & oReader("FromTitle") Else cTitle = "" End If If ca = "T" then cAccount = " - " & oReader("FromAccount") Else cAccount = "" End If oTree.Add("id" & oReader("HTML"), ID, "" & oReader("FromLastname") & ", " & oReader("FromFirstname") & cTitle & cAccount & "", bol, "contact.gif") Loop oReader.Close Cn.Close '---------------------------------------------------------------------------------------------------------------------------------- 'Populate From Relations '---------------------------------------------------------------------------------------------------------------------------------- SQL2 = "select distinct(backrelation) from association where ToID = '" & conid & "' and ACCOUNTASSOCIATION = 'F'" Com2 = new OleDBCommand(SQL2,Cn) Cn.Open oReader2 = Com2.ExecuteReader() 'Add To Relationships Do While oReader2.Read() oTree.Add("id2", "id2" & oReader2("backrelation"), "as " & oReader2("backrelation") & " to:", bol, nIcon) Loop oReader2.Close Cn.Close SQL = "SELECT ASSOCIATION.FROMID AS PARENT, ASSOCIATION.ASSOCIATIONID AS ID, ASSOCIATION.BACKRELATION AS HTML, " & _ "CONTACT.FIRSTNAME AS ToFirstname, CONTACT.LASTNAME AS ToLastname, CONTACT_1.LASTNAME AS FromLastname, " & _ "CONTACT_1.FIRSTNAME AS FromFirstname, ASSOCIATION.TOID, CONTACT.ACCOUNT as ToAccount, CONTACT.TITLE as ToTitle, CONTACT_1.ACCOUNT as FromAccount, CONTACT_1.TITLE as FromTitle " & _ "FROM ASSOCIATION INNER JOIN " & _ "CONTACT ON ASSOCIATION.FROMID = CONTACT.CONTACTID INNER JOIN " & _ "CONTACT CONTACT_1 ON ASSOCIATION.TOID = CONTACT_1.CONTACTID " & _ "WHERE(ASSOCIATION.TOID = '" & conid & "') AND (ASSOCIATION.ACCOUNTASSOCIATION = 'F') " & _ "ORDER BY HTML" Com = new OleDBCommand(SQL,Cn) Cn.Open oReader = Com.ExecuteReader() ' Populate TreeView in one loop. 'Add Accounts to Forward Relationships Do While oReader.Read() ID = ID + 1 If ct = "T" then cTitle = " - " & oReader("ToTitle") Else cTitle = "" End If If ca = "T" then cAccount = " - " & oReader("ToAccount") Else cAccount = "" End If oTree.Add("id2" & oReader("HTML"), ID, "" & oReader("ToLastname") & ", " & oReader("ToFirstname") & cTitle & cAccount & "", bol, "contact.gif") Loop oReader.Close Cn.Close '---------------------------------------------------------------------------------------------------------------------------------- 'Populate Opportunities '---------------------------------------------------------------------------------------------------------------------------------- SQL = "SELECT o.DESCRIPTION, oc.CONTACTID, oc.SALESROLE, o.OPPORTUNITYID " & _ "FROM OPPORTUNITY o INNER JOIN " & _ "OPPORTUNITY_CONTACT oc ON oc.OPPORTUNITYID = o.OPPORTUNITYID " & _ "WHERE (oc.CONTACTID = '" & conid &"') " & _ "ORDER BY o.DESCRIPTION " Com = new OleDBCommand(SQL,Cn) Cn.Open oReader = Com.ExecuteReader() ' Populate TreeView in one loop. 'Add Accounts to Forward Relationships Do While oReader.Read() ID = ID + 1 oTree.Add("id3", ID, "" & oReader("DESCRIPTION") & " - " & oReader("SALESROLE") & "", bol, "oppdetail.gif") Loop oReader.Close Cn.Close '---------------------------------------------------------------------------------------------------------------------------------- 'Populate Campaign Contacts '---------------------------------------------------------------------------------------------------------------------------------- 'SQL = "SELECT cc.CONTACTID, cp.CAMPAIGNNAME, cp.CAMPAIGNTYPE, cp.ACTUALLAUNCHDATE, cp.CAMPAIGNID " & _ ' "FROM CAMPAIGNCONTACT cc INNER JOIN " & _ ' "CAMPAIGN cp ON cp.CAMPAIGNID = cc.CAMPAIGNID " & _ ' "WHERE (cc.CONTACTID = '" & conid &"') " & _ ' "ORDER BY cp.CAMPAIGNNAME" 'Com = new OleDBCommand(SQL,Cn) 'Cn.Open 'oReader = Com.ExecuteReader() ' Populate TreeView in one loop. 'Add Accounts to Forward Relationships 'Do While oReader.Read() ' ID = ID + 1 ' oTree.Add("id4", ID, "" & oReader("ACTUALLAUNCHDATE") & " - " & oReader("CAMPAIGNNAME")& " - " & oReader("CAMPAIGNTYPE") & "", bol, "camdetail.gif") 'Loop 'oReader.Close 'Cn.Close '---------------------------------------------------------------------------------------------------------------------------------- 'Populate Events Contacts '---------------------------------------------------------------------------------------------------------------------------------- SQL = "SELECT E1TB_EVTDESC.EVENT_NAME AS eName, CONVERT(varchar, E1TB_EVENTS.STARTDATE, 103) AS eDate, E1TB_ATTS.STATUS AS eStatus, E1TB_ATTS.E1TB_EVENTSID AS eID, " & _ "E1TB_EVENTS.SUBNAME AS eSubname, E1TB_ATTS.ATTENDEE_CONTACTID " & _ "FROM E1TB_ATTS INNER JOIN " & _ "E1TB_EVENTS ON E1TB_ATTS.E1TB_EVENTSID = E1TB_EVENTS.E1TB_EVENTSID INNER JOIN " & _ "E1TB_EVTDESC ON E1TB_EVENTS.E1TB_EVTDESCID = E1TB_EVTDESC.E1TB_EVTDESCID " & _ "WHERE (E1TB_ATTS.ATTENDEE_CONTACTID = '" & conid &"')" Com = new OleDBCommand(SQL,Cn) Cn.Open oReader = Com.ExecuteReader() ' Populate TreeView in one loop. 'Add Accounts to Forward Relationships Do While oReader.Read() ID = ID + 1 oTree.Add("id5", ID, "" & oReader("eDate") & " - " & oReader("eName")& " - " & oReader("eSubName") & "", bol, "camdetail.gif") Loop oReader.Close Cn.Close 'Add results to tree view TreeView.Text = oTree.HTML() oTree = Nothing End Sub
The add the control to your page: ASP:LITERAL id="TreeView" runat="server" EnableViewState="false" |
|
|
|
Re: Tree View in Web Client
Posted: 03 Oct 06 2:59 AM
|
fiogf49gjkf0d Unfortunately some of the codes been lost in the format, but hopefully you get the idea, if you want the full code drop me an email -- Duncan
|
|
|
|
Re: Tree View in Web Client
Posted: 03 Oct 06 5:54 AM
|
fiogf49gjkf0d Duncan,
I looked everywhere for an example and I guess I forgot to look at the group manager. I'll give it a shot today and see where I end up. |
|
|
|
Re: Tree View in Web Client
Posted: 10 Oct 06 12:50 PM
|
fiogf49gjkf0d I have used 2 different approaches to Tree Controls within a single project: - I built an ActiveX - I used .NET and a third party Tree control
In both cases I used client side events to interact with other parts of the system (e.g. Switch to a different View, load a different Contact, create associations, perform lookups, etc).
|
|
|
|
You can
subscribe to receive a daily forum digest in your
user profile. View the site code
of conduct for posting guidelines.
Forum RSS Feed - Subscribe to the forum RSS feed to keep on top of the latest forum activity!
|
|
|
|
|
|
|
|