S
sck10
Hello,
I have a method in my codefile that builds a sorted list (see CodeFile). I
am trying to create a class that does the same thing (see App_Code).
CodeFile
===================================
public void PostSearch(string HRID)
{
SortedList PostSearchList = new SortedList();
try
{
....
foreach(PropertyValueCollection props in item.Properties)
{
PostSearchList.Add(props.PropertyName.ToString(),
props[0].ToString());
}
//Set Values
this.hdnLDAPEmail.Value = PostSearchList["mail"].ToString().Trim();
this.hdnLDAPTelephone.Value =
PostSearchList["telephonenumber"].ToString().Trim();
} // end try
catch(Exception ex)
{
string strNoLDAP = "<br /><br />Please submit a <a
href='members.aspx'>New HRID</a>.<br />";
}
}
App_Code
===================================
public SortedList PostSearchHRID(string HRID)
{
SortedList PostSearchList = new SortedList();
try
{
foreach(PropertyValueCollection props in item.Properties)
{
PostSearchList.Add(props.PropertyName.ToString(),
props[0].ToString());
}
return PostSearchList;
} // end try
catch(Exception ex)
{
strNoLDAP += "<br /><br /><span class=BlkB>LDAP Error</span><br />" +
ex.Message.ToString();
PostSearchList.Add("Catch Exception", strNoLDAP);
return PostSearchList;
}
} // end class
My question is how do you return a sorted list that's in the class?
Code calling the class
======================
protected void Page_Load(object sender, EventArgs e)
{
string LDAPName = this.AppCodePostSearch("cn").ToString();
}
protected SortedList AppCodePostSearch()
{
PostSearch PostSearchHelper = new PostSearch();
return PostSearchHelper.PostSearchHRID(this.txtHRID.Text);
}
When I try to reference the class, I get the following:
?LDAPName = "System.Collections.SortedList"
The actual value should be ?LDAPName = "Last Name, First Name"
Any help would be appreciated. Thanks, sck10
I have a method in my codefile that builds a sorted list (see CodeFile). I
am trying to create a class that does the same thing (see App_Code).
CodeFile
===================================
public void PostSearch(string HRID)
{
SortedList PostSearchList = new SortedList();
try
{
....
foreach(PropertyValueCollection props in item.Properties)
{
PostSearchList.Add(props.PropertyName.ToString(),
props[0].ToString());
}
//Set Values
this.hdnLDAPEmail.Value = PostSearchList["mail"].ToString().Trim();
this.hdnLDAPTelephone.Value =
PostSearchList["telephonenumber"].ToString().Trim();
} // end try
catch(Exception ex)
{
string strNoLDAP = "<br /><br />Please submit a <a
href='members.aspx'>New HRID</a>.<br />";
}
}
App_Code
===================================
public SortedList PostSearchHRID(string HRID)
{
SortedList PostSearchList = new SortedList();
try
{
foreach(PropertyValueCollection props in item.Properties)
{
PostSearchList.Add(props.PropertyName.ToString(),
props[0].ToString());
}
return PostSearchList;
} // end try
catch(Exception ex)
{
strNoLDAP += "<br /><br /><span class=BlkB>LDAP Error</span><br />" +
ex.Message.ToString();
PostSearchList.Add("Catch Exception", strNoLDAP);
return PostSearchList;
}
} // end class
My question is how do you return a sorted list that's in the class?
Code calling the class
======================
protected void Page_Load(object sender, EventArgs e)
{
string LDAPName = this.AppCodePostSearch("cn").ToString();
}
protected SortedList AppCodePostSearch()
{
PostSearch PostSearchHelper = new PostSearch();
return PostSearchHelper.PostSearchHRID(this.txtHRID.Text);
}
When I try to reference the class, I get the following:
?LDAPName = "System.Collections.SortedList"
The actual value should be ?LDAPName = "Last Name, First Name"
Any help would be appreciated. Thanks, sck10