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(stri ng HRID)
{
SortedList PostSearchList = new SortedList();
try
{
....
foreach(Propert yValueCollectio n props in item.Properties )
{
PostSearchList. Add(props.Prope rtyName.ToStrin g(),
props[0].ToString());
}
//Set Values
this.hdnLDAPEma il.Value = PostSearchList["mail"].ToString().Tri m();
this.hdnLDAPTel ephone.Value =
PostSearchList["telephonenumbe r"].ToString().Tri m();
} // end try
catch(Exception ex)
{
string strNoLDAP = "<br /><br />Please submit a <a
href='members.a spx'>New HRID</a>.<br />";
}
}
App_Code
=============== =============== =====
public SortedList PostSearchHRID( string HRID)
{
SortedList PostSearchList = new SortedList();
try
{
foreach(Propert yValueCollectio n props in item.Properties )
{
PostSearchList. Add(props.Prope rtyName.ToStrin g(),
props[0].ToString());
}
return PostSearchList;
} // end try
catch(Exception ex)
{
strNoLDAP += "<br /><br /><span class=BlkB>LDAP Error</span><br />" +
ex.Message.ToSt ring();
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(objec t sender, EventArgs e)
{
string LDAPName = this.AppCodePos tSearch("cn").T oString();
}
protected SortedList AppCodePostSear ch()
{
PostSearch PostSearchHelpe r = new PostSearch();
return PostSearchHelpe r.PostSearchHRI D(this.txtHRID. Text);
}
When I try to reference the class, I get the following:
?LDAPName = "System.Collect ions.SortedList "
The actual value should be ?LDAPName = "Last Name, First Name"
Any help would be appreciated. Thanks, sck10