Welcome Guest Search | Active Topics | Sign In | Register

EO.Web.Treeview Options
Venkat
Posted: Wednesday, November 28, 2007 3:30:27 PM
Rank: Member
Groups: Member

Joined: 9/28/2007
Posts: 20
I am trying to add a nodes to EO.Web.Treeview control. However nodes are getting added but they are not displayed in treeview control. I am querying the database and creating nodes based on the data returned. I am using the "Topgroup" and their "SubGroup" to add nodes. It is getting added but not displayed in Treeview. Following is the code, I am using to a node in Treeview.

string prevClientID = ClientEngSearch.ClientEngList[intClientCount].ClientID;
currTreeNode = new EO.Web.TreeNode(prevClientID + " - " + ClientEngSearch.ClientEngList[intClientCount].ClientName);
//
currTreeNode.Text = prevClientID + " - " + ClientEngSearch.ClientEngList[intClientCount].ClientName;
if (currClientID != prevClientID)
{
currTreeNode.ShowCheckBox = EO.Web.NullableBool.True;
currTreeNode.Visible = true;
trwLeft.TopGroup.Nodes.Add(currTreeNode);
treeNodeAdded = true;
// currTreeNode.PopulateOnDemand = true;
}
eo_support
Posted: Wednesday, November 28, 2007 3:45:46 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Try it in a blank page and check where you add them. If you add them in Page_Load, then it's impossible that you add them but they are not displayed. If you add them in ItemPopulate event, then you can not add new nodes to anywhere else except as child node the node being populated. Also check whether you are using any AJAX solution that did not update the TreeView.
Venkat
Posted: Thursday, November 29, 2007 11:07:19 AM
Rank: Member
Groups: Member

Joined: 9/28/2007
Posts: 20
Thanks for your reply. I am not adding the nodes in "ItemPopulate" event. I am adding nodes on click of server side button (<asp:button>). I am using a Master page and content page concept. When this event gets fired, page_load event of master page also get executed. I am writting the code of adding nodes in content page.
eo_support
Posted: Thursday, November 29, 2007 11:53:49 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi Venkat,

In that case we would need you to create a sample app to demonstrate the problem. We will look into it immediately once we have that.

Thanks
Venkat
Posted: Thursday, November 29, 2007 1:30:22 PM
Rank: Member
Groups: Member

Joined: 9/28/2007
Posts: 20
I am sending Master and Content page code. Nodes are getting added in content page.

//=======================Content Page Code - Start ====================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
using PDR.Messages;
using PDR.Site;


public partial class WIPdescr : Page
{
public PdrReports objMasterPage;
public MessageBroker messageBroker = null;
public string GPN = "";
protected void Page_Init(object sender, EventArgs e)
{
lblName_search_text.Text = "Enter a Client Name to Search for";
}
protected void Page_Load(object sender, EventArgs e)
{
GetAccessMessage msg = new GetAccessMessage();
//msg = Master.CurrentUser;

objMasterPage = (PdrReports)Page.Master;
// **********Commented this line to skip LDAP Authentication, to get rid of using

account for HPT. Once new account is created,
// uncomment following code

//msg = objMasterPage.AuthenticateUser();
//objMasterPage._GPN = msg.APPUserID;
//objMasterPage._UserName = msg.FullName;

// ****************************End of getting rid of using account got HPT. We need to

uncomment above code, once new account for PDR is created

objMasterPage._GPN = "US011694773";
objMasterPage._UserName = "Ashok Dev";
this.btnSearch.Attributes.Add("Onclick", "checkThis");

this.GPN = objMasterPage._GPN;
}

protected void Moveto_Right(object sender, EventArgs e)
{
int iIndex = 0;
int jIndex = 0;
if (chkAll.Checked)
{
trwRight.TopGroup.Nodes.Clear();
for(iIndex=0; iIndex<trwLeft.TopGroup.Nodes.Count;iIndex++)
{
trwRight.TopGroup.Nodes.Add(trwLeft.TopGroup.Nodes[iIndex].Text); // Add

Parent Node

for (jIndex = 0; jIndex < trwLeft.TopGroup.Nodes[iIndex].ChildNodes.Count;

jIndex++)
{


trwRight.TopGroup.Nodes[iIndex].ChildNodes.Add(trwLeft.TopGroup.Nodes[iIndex].ChildNodes[jInde

x].Text); // Here add Child Node.
if (trwLeft.TopGroup.Nodes[iIndex].ChildNodes[jIndex].Checked)
trwRight.TopGroup.Nodes[iIndex].ChildNodes[jIndex].Checked = true;
}
}
return;
}

foreach (EO.Web.TreeNode node in trwLeft.TopGroup.Nodes)
{
Boolean bIn = false;
foreach (EO.Web.TreeNode nd in node.SubGroup.Nodes)
{
if (nd.Checked) bIn = true;
}

if (node.Checked || bIn) {

Boolean bInTree2Top = false;

foreach (EO.Web.TreeNode node2 in trwRight.TopGroup.Nodes)
{
if (node2.Text == node.Text)
{
bInTree2Top = true;

foreach (EO.Web.TreeNode nd in node.SubGroup.Nodes)
{
if (nd.Checked)
{
nd.Checked = false;
Boolean bInTree2Sub = false;

foreach (EO.Web.TreeNode nd2 in node2.SubGroup.Nodes)
{
if (nd2.Text == nd.Text)
bInTree2Sub = true;
}
if (!bInTree2Sub) node2.ChildNodes.Add(nd.Text);


}
}
}
}
if (!bInTree2Top)
{
EO.Web.TreeNode parentNode2 = trwRight.TopGroup.Nodes.Add(node.Text);

foreach (EO.Web.TreeNode nd in node.SubGroup.Nodes)
{
if (nd.Checked)
{
nd.Checked = false;
parentNode2.ChildNodes.Add(nd.Text);
}
}
}
}
}
}

protected void Moveto_Left(object sender, EventArgs e)
{
if (chkAll.Checked && trwRight.TopGroup.Nodes.Count > 0)
{
string script = "<script type='text/javascript'>var result= confirm('You have

selected all items. Do you want to continute?');</script>";

Page.RegisterClientScriptBlock("confirm", script);

//chkAll.Checked = false;
//trwRight.Nodes.Clear();
// Here is the code to move entire left to right.

int iIndex = 0;
int jIndex = 0;
EO.Web.TreeNode trNode;
if (chkAll.Checked)
{
trwLeft.TopGroup.Nodes.Clear();
for (iIndex = 0; iIndex < trwRight.TopGroup.Nodes.Count; iIndex++)
{


trwLeft.TopGroup.Nodes.Add((EO.Web.TreeNode)trwRight.TopGroup.Nodes[iIndex]); // Add Parent

Node

for (jIndex = 0; jIndex <

trwRight.TopGroup.Nodes[iIndex].ChildNodes.Count; jIndex++)
{
trNode = trwRight.TopGroup.Nodes[iIndex].ChildNodes[jIndex];
trwLeft.TopGroup.Nodes[iIndex].ChildNodes.Add((EO.Web.TreeNode)

trNode); // Here add Child Node.
if (trwRight.TopGroup.Nodes[iIndex].ChildNodes[jIndex].Checked)
trwLeft.TopGroup.Nodes[iIndex].ChildNodes[jIndex].Checked = true;
}
}

chkAll.Checked = false;
trwRight.Nodes.Clear();

return;
}

}
else
{
for (int i = 0; i < trwRight.TopGroup.Nodes.Count; i++)
{
EO.Web.TreeNode node = trwRight.TopGroup.Nodes[i];
if (node.Checked)
trwRight.Nodes.Remove(node);
else
{
for (int j = 0; j < node.ChildNodes.Count; j++)
{
if (node.ChildNodes[j].Checked)
node.SubGroup.Nodes.Remove(node.ChildNodes[j]);
}
}
}
}
}
protected void chkAll_Click(object sender, EventArgs e)
{

}


protected void search_Changed(object sender, EventArgs e)
{
System.Web.UI.WebControls.RadioButton radioSender =

(System.Web.UI.WebControls.RadioButton)sender;
lblName_search_text.Text = "Enter a " +

radioSender.Text.Substring(0,(radioSender.Text.Length-1)) + " to Search for";

}

protected void date_Changed(object sender, EventArgs e)
{

}
protected void btnSearch_Click(object sender, EventArgs e)
{
string SearchItem = "";
string currClientID = "";
string prevClientID = "";
string currEngData = "";
bool treeNodeAdded = false;
EO.Web.TreeNode currTreeNode;

// Here write a query to search an item.
ClientEngSearchMessage ClientEngSearch = new ClientEngSearchMessage();
if (Request["selBusinessUnits"] == "1") // All business units
ClientEngSearch.BusinessUnit = Request["hidAllBusinessUnits"];
else
ClientEngSearch.BusinessUnit = "'" + Request["selBusinessUnits"] + "'";

ClientEngSearch.EmplID = "US011047778";//this.GPN;
ClientEngSearch.RoleCode = Request["hidRoleCodes"];
ClientEngSearch.OUList = Request["hidOuCodes"];
ClientEngSearch.MUList = Request["hidMuCodes"];
ClientEngSearch.SMUList = Request["hidSMUCodes"];
ClientEngSearch.EngType = Request["selEngType"];
ClientEngSearch.EngClass = Request["selEngClass"];
ClientEngSearch.Relieved = Request["selRelHours"];

if (Request["selRoleFilter"] == "0")
ClientEngSearch.ClientEngRole = false;
else
ClientEngSearch.ClientEngRole = true;

// Here Set the parameter depending on User Selection.

SearchItem = this.txtNameSearch.Text;

if (this.radClientID.Checked)
ClientEngSearch.ClientID = SearchItem;
else if (this.radClientName.Checked)
ClientEngSearch.ClientName = SearchItem;
else if (this.radEngID.Checked)
ClientEngSearch.EngID = SearchItem;
else if (this.radEngName.Checked)
ClientEngSearch.EngName = SearchItem;

// Now call the DataAction:

objMasterPage.messageBroker.Invoke("GetClientEngData", ref ClientEngSearch);

if (null != ClientEngSearch.ClientEngList)
{
trwLeft.Nodes.Clear();

for (int intClientCount = 0; intClientCount <=

ClientEngSearch.ClientEngList.Length - 1; intClientCount++)
{

prevClientID = ClientEngSearch.ClientEngList[intClientCount].ClientID;
currTreeNode = new EO.Web.TreeNode(prevClientID + " - " +

ClientEngSearch.ClientEngList[intClientCount].ClientName);
//
currTreeNode.Text = prevClientID + " - " +

ClientEngSearch.ClientEngList[intClientCount].ClientName;
if (currClientID != prevClientID)
{
currTreeNode.ShowCheckBox = EO.Web.NullableBool.True;
currTreeNode.Visible = true;
trwLeft.TopGroup.Nodes.Add(currTreeNode);
treeNodeAdded = true;
currTreeNode.Visible = true;
}

if (treeNodeAdded)
{
for (int intEngCount = 0; intEngCount <=

ClientEngSearch.ClientEngList.Length - 1; intEngCount++)
{
currClientID = ClientEngSearch.ClientEngList[intEngCount].ClientID;
if (prevClientID == currClientID)
{
currEngData = ClientEngSearch.ClientEngList[intEngCount].EngID + "

- " + ClientEngSearch.ClientEngList[intEngCount].EngName;
currTreeNode = new EO.Web.TreeNode(currEngData);
currTreeNode.Text = currEngData;
currTreeNode.ShowCheckBox = EO.Web.NullableBool.True;


trwLeft.TopGroup.Nodes[intClientCount].SubGroup.Nodes.Add(currTreeNode);
currTreeNode.Visible = true;
}
}
treeNodeAdded = false;
}


}

}

}
protected void chkAll_CheckedChanged(object sender, EventArgs e)
{

}
}

====================Content Page Code - End=========================

====================Master Page Code - Start=========================
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using EY.ADAuth;
using EY.GFIS.Core;
using EY.GFIS.Core.Messages;
using PDR.Site;
using PDR.Messages;
using System.Security.Principal;

public partial class PdrReports : System.Web.UI.MasterPage
{
public MessageBroker messageBroker = null;
public GetAccessMessage CurrentUser = null;
public double SessionTimeout = 20;
public string strTimeOutExpired = "";
public string _UserName = "";
public string _GPN = "";
public string UserEngManCountry = "";
public string UserPerManCountry = "";
public string SelectedManCountry = "";
public string SelectedReportID = "";

public PdrReports()
{
this.Load += new EventHandler(PdrReports_Load);
//this.cboReports.SelectedIndexChanged += new EventHandler(cboReports_SelectedIndexChanged);
}




public void PdrReports_Load(object sender, EventArgs e)
{
string userHistoryReportId = "";
string strTempEngManCountry = "";
string strTempPerManCountry = "";
string strPrevReportID = "";

EY.GFIS.Core.Caching.ICacheWrapper cw = new EY.GFIS.Core.Caching.ASPCacheWrapper(this.Cache);
messageBroker = new MessageBroker(cw);

// Get Previously selected Report ID:
strPrevReportID = Request["reportID"]; //this.cboReports.Items[this.cboReports.SelectedIndex].Value;

// Get the Engagement Managerial Country
if (null != Request["EngManCountry"] && null != Request["PerManCountry"])
{
strTempEngManCountry = Request["EngManCountry"].ToString();
strTempPerManCountry = Request["PerManCountry"].ToString();
}
else
{
strTempEngManCountry = Request["SelectedEngManCountry"].ToString();
strTempPerManCountry = Request["SelectedEngManCountry"].ToString();
}
if (UserEngManCountry == null || UserEngManCountry.Trim() == "")
UserEngManCountry = strTempEngManCountry.Substring(strTempEngManCountry.Length-4,4);

// Get the Personal Managerial Country

if (UserPerManCountry == null || UserPerManCountry.Trim() == "")
UserPerManCountry = strTempPerManCountry.Substring(strTempPerManCountry.Length-4,4) ;

GetRptUserMessage UserRPTMessage = new GetRptUserMessage();

UserRPTMessage.AppUserID = _GPN;
UserRPTMessage.EngManCountry = UserEngManCountry.Trim();
UserRPTMessage.PerManCountry = UserPerManCountry.Trim();

this.messageBroker.Invoke("GetUserHistoryReports", ref UserRPTMessage);

if(null != UserRPTMessage.UserReportHistoryArray)
if(UserRPTMessage.UserReportHistoryArray.Length>0)
userHistoryReportId = UserRPTMessage.UserReportHistoryArray[UserRPTMessage.UserReportHistoryArray.Length-1].ToString() ;

this.messageBroker.Invoke("GetUserAccessReports", ref UserRPTMessage);

if (!IsPostBack) // To check if populating a dropdown for first time.
{
this.cboReports.Items.Clear();

if (null != UserRPTMessage.UserReportsAccessListArray && UserRPTMessage.UserReportsAccessListArray.Length > 1)
{
for (int intRepListCount = 0; intRepListCount <= UserRPTMessage.UserReportsAccessListArray.Length - 1; intRepListCount++)
{
//this.cboReports.Items.Add(UserRPTMessage.UserReportsAccessListArray[intRepListCount].ReportDesc);

this.cboReports.Items.Add(new ListItem(UserRPTMessage.UserReportsAccessListArray[intRepListCount].ReportDesc, UserRPTMessage.UserReportsAccessListArray[intRepListCount].ReportID));
if (strPrevReportID == UserRPTMessage.UserReportsAccessListArray[intRepListCount].ReportID)
this.cboReports.Items[intRepListCount].Selected = true;
}
// Store default Report ID:
//this.SelectedReportID = this.cboReports.Items[0].Value;
}
}
else
{
for (int intRepListCount = 0; intRepListCount <= cboReports.Items.Count - 1; intRepListCount++)
{
//this.cboReports.Items.Add(UserRPTMessage.UserReportsAccessListArray[intRepListCount].ReportDesc);

if (strPrevReportID == cboReports.Items[intRepListCount].Value)
this.cboReports.Items[intRepListCount].Selected = true;
}
//this.SelectedReportID = this.cboReports.Items[cboReports.SelectedIndex].Value;
}
this.SelectedReportID = this.cboReports.Items[cboReports.SelectedIndex].Value;


// Now populate the Managerial countries

GetClientManCountryMessage msgClientManCountries = new GetClientManCountryMessage();

// Here get the data for Managerial Country and Person Managerial Country.
msgClientManCountries.appUserID = _GPN;

this.messageBroker.Invoke("GetPDRClientManCountry", ref msgClientManCountries);

if (!IsPostBack)
{
cboManCountry.Items.Clear(); // Clear all existing items

for (int intClientManCountry = 0; intClientManCountry < msgClientManCountries.PDRClientManCountry.Length; intClientManCountry++)
{
if (msgClientManCountries.PDRClientManCountry[intClientManCountry].MCFlag == "E")
{
// Here Populate Client Man Country:
//cboManCountry.Items.Add( new ListItem(msgClientManCountries.PDRClientManCountry[intClientManCountry].Description + " - " + msgClientManCountries.PDRClientManCountry[intClientManCountry].ManCountry),);
this.cboManCountry.Items.Add(new ListItem(msgClientManCountries.PDRClientManCountry[intClientManCountry].Description + " - " + msgClientManCountries.PDRClientManCountry[intClientManCountry].ManCountry, msgClientManCountries.PDRClientManCountry[intClientManCountry].ManCountry));
if (strTempEngManCountry == msgClientManCountries.PDRClientManCountry[intClientManCountry].ManCountry)
this.cboManCountry.Items[this.cboManCountry.Items.Count-1].Selected = true;
}
}
// Store default Report ID:
this.SelectedManCountry = this.cboManCountry.Items[cboManCountry.SelectedIndex].Value;
}
}




public GetAccessMessage GetUserDetailsFromCookie(string cookieValue)
{
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();

System.IO.MemoryStream mstream = new System.IO.MemoryStream();

byte[] serializedData = Convert.FromBase64String(cookieValue);
mstream.Write(serializedData, 0, serializedData.Length);
mstream.Seek(0, System.IO.SeekOrigin.Begin);
return bf.Deserialize(mstream) as GetAccessMessage;
}

public string GetUserDetailsStringForCookie(GetAccessMessage msg)
{
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bf = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
System.IO.MemoryStream mstream = new System.IO.MemoryStream();
bf.Serialize(mstream, msg);
return Convert.ToBase64String(mstream.ToArray());
}
protected void cboReports_SelectedIndexChanged(object sender, EventArgs e)
{
string strEngManCountry = "";
string strReportID = this.cboReports.SelectedItem.Value.ToString() ;
string strReportDesc = this.cboReports.SelectedItem.Text.ToString();

// Here populate Managerial countries now
GetClientManCountryMessage UserManCountriesPopulation = new GetClientManCountryMessage();

UserManCountriesPopulation.appUserID = this._GPN;
UserManCountriesPopulation.reportID = strReportID;
UserManCountriesPopulation.reportDesc = strReportDesc;


this.SelectedReportID = strReportID; // Get the selected Report ID.
this.SelectedManCountry = cboManCountry.SelectedValue.Substring(cboManCountry.SelectedValue.Length-4,4); // Get the selected Man Country.

this.messageBroker.Invoke("PopulateClientEngCountries", ref UserManCountriesPopulation);

strEngManCountry = cboManCountry.SelectedValue;

cboManCountry.Items.Clear(); // Clear all existing items

for (int intClientManCountry = 0; intClientManCountry < UserManCountriesPopulation.PDRClientManCountry.Length; intClientManCountry++)
cboManCountry.Items.Add(UserManCountriesPopulation.PDRClientManCountry[intClientManCountry].Description + " - " + UserManCountriesPopulation.PDRClientManCountry[intClientManCountry].ManCountry);

// Do a response.redirect here to redirect a user to corresponding page:

strReportDesc = strReportDesc.ToUpper(); // Convert everything to Upper case

switch (strReportDesc)
{
case "INVOICE DETAILS":

break;
case "INVOICE HISTORY":
break;
case "UTILIZATION":
break;
case "WIP - INPUT DESCRIPTION":
Response.Redirect("WIPDescription.aspx?SelectedEngManCountry=" + this.SelectedManCountry + "&SelectedPerManCountry=" + this.SelectedManCountry + "&reportID=" + strReportID); //
break;
case "INTER-FIRM BILLING":
Response.Redirect("InterFirm.aspx?SelectedEngManCountry=" + this.SelectedManCountry + "&SelectedPerManCountry=" + this.SelectedManCountry + "&reportID=" + strReportID); //
break;
default:
break;
}
}
protected void cboManCountry_SelectedIndexChanged(object sender, EventArgs e)
{
string strManCountry = "";
string strReportDesc = "";
string strReportID = "";
GetRptUserMessage UserReportPopulation = new GetRptUserMessage();

strManCountry = this.cboManCountry.SelectedValue;

//this.SelectedReportID = this.cboReports.SelectedValue; // Get the selected Report ID.
this.SelectedManCountry = strManCountry.Substring(strManCountry.Length - 4, 4); // Get the selected Man Country.

UserReportPopulation.AppUserID = _GPN;
UserReportPopulation.EngManCountry = strManCountry.Substring(strManCountry.Length - 4, 4);
UserReportPopulation.PerManCountry = strManCountry.Substring(strManCountry.Length - 4, 4);

this.messageBroker.Invoke("GetUserAccessReports", ref UserReportPopulation);

this.cboReports.Items.Clear();

for (int intRepListCount = 0; intRepListCount <= UserReportPopulation.UserReportsAccessListArray.Length - 1; intRepListCount++)
this.cboReports.Items.Add(new ListItem(UserReportPopulation.UserReportsAccessListArray[intRepListCount].ReportDesc, UserReportPopulation.UserReportsAccessListArray[intRepListCount].ReportID));

strReportDesc = this.cboReports.Items[0].Text; // Convert everything to Upper case

strReportDesc = strReportDesc.ToUpper();
strReportID = this.cboReports.Items[0].Value;
this.SelectedReportID = strReportID;

switch (strReportDesc)
{
case "INVOICE DETAILS":

break;
case "INVOICE HISTORY":
break;
case "UTILIZATION":
break;
case "WIP - INPUT DESCRIPTION":
Response.Redirect("WIPDescription.aspx?SelectedEngManCountry=" + this.SelectedManCountry + "&SelectedPerManCountry=" + this.SelectedManCountry + "&reportID=" + strReportID); //
break;
case "INTER-FIRM BILLING":
Response.Redirect("InterFirm.aspx?SelectedEngManCountry=" + this.SelectedManCountry + "&SelectedPerManCountry=" + this.SelectedManCountry + "&reportID=" + strReportID); //
break;
default:
break;
}
}
}

==================================Master Page Code - End==============
eo_support
Posted: Thursday, November 29, 2007 1:34:22 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,088
Hi Venkat,

You can't really paste your page like that. There is no way we can run it because it references all of your other stuff. We need you to isolate the problem into a small project that we can load and run here in order to troubleshoot it.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.