473,585 Members | 2,513 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieve SortedList from Class (App_Code)

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
Sep 24 '06 #1
4 1534
Hi sck10,

Do you have another implementation of AppCodePostSear ch() which takes one
string parameter? I think your code calling the AppCodePostSear ch() should
be:

protected void Page_Load(objec t sender, EventArgs e)
{
string LDAPName = this.AppCodePos tSearch()["cn"].ToString();
}

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 25 '06 #2
Thank you very much Walter,

That answered my second question of how to send a value to the method
"AppCodePostSea rch(this.HRID.T ext)":

string LDAPName = this.AppCodePos tSearch(this.HR ID.Text)["cn"].ToString();

Cheers...

"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:PS******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi sck10,

Do you have another implementation of AppCodePostSear ch() which takes one
string parameter? I think your code calling the AppCodePostSear ch() should
be:

protected void Page_Load(objec t sender, EventArgs e)
{
string LDAPName = this.AppCodePos tSearch()["cn"].ToString();
}

Sincerely,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your
reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Sep 25 '06 #3
Hi sck10,

Sorry, I overlooked the first question "how do you return a sorted list
that's in the class?". However, I'm not very clear about what do you mean
of the question. Could you please depict more? Thanks.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.

Sep 26 '06 #4
Hi Walter,

Both my question of 1. how to return a SortedList and how to provide a value
to the method were answered when you showed me the correct syntax.

I originally created the following to call a class in App_Code that I could
supply a parameter value:

Example 1
=============== =========
protected SortedList AppCodePostSear ch(string HRID)
{
PostSearch PostSearchHelpe r = new PostSearch();
return PostSearchHelpe r.PostSearchHRI D(HRID);
}

I couldn't figure out how to send a value to the class so I hard coded the
method:

Example 2
=============== =========
protected SortedList AppCodePostSear ch()
{
PostSearch PostSearchHelpe r = new PostSearch();
return PostSearchHelpe r.PostSearchHRI D(this.txtHRID. Text);
}
The reason I couldn't figure out how to send the parameter value (example 1)
instead of hard coding the value (example 2) was because my of my syntax:

What I originally had was wrong:
string LDAPName = this.AppCodePos tSearch["cn"].ToString();

which should have been:
string LDAPName = this.AppCodePos tSearch().["cn"].ToString();

which leads to:
string LDAPName = this.AppCodePos tSearch(this.HR ID.Text)["cn"].ToString();

As always, thanks for all your help...

sck10


"Walter Wang [MSFT]" <wa****@online. microsoft.comwr ote in message
news:l0******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hi sck10,

Sorry, I overlooked the first question "how do you return a sorted list
that's in the class?". However, I'm not very clear about what do you mean
of the question. Could you please depict more? Thanks.

Regards,
Walter Wang (wa****@online. microsoft.com, remove 'online.')
Microsoft Online Community Support

=============== =============== =============== =====
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no
rights.

Sep 26 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
20519
by: gerrod | last post by:
Hi - Does anyone know a way to created a SortedList (in the System.Collections namespace) that will sort on VALUES instead of KEYS... ? The scenario is this - I have a SortedList containing key-value pairs of UserID - DisplayName for a whole bunch of user objects. The UserID is simply a long, the DisplayName is something like, "Jones,...
6
1868
by: Jose Jarabo | last post by:
Hello, thanks in advance for any and all replies. I am not sure how to categorize this, either a bug or something else but here is my problem. I am testing with 2 elements on a sorted list. If I remove the last element on the list everything works fine and I can add other elements to it. However if I remove the first element on the list...
5
5895
by: Brett Romero | last post by:
I'd like to type a SortedList as very generic on class instantiation: SortedList<T, T> _sl; Then in two particular methods of the class that is called first(of which only one or the other is used per instance), I will do _sl = new SortedList<string,int>(); or
2
2037
by: Prez | last post by:
I started writing .net code yesterday and I am grasping it well enough. I have a few questions about SortedLists. I am using managed C++ if that makes any difference. Of the examples I have seen it looks like the Sorted List does not use the ^ while other variables do use the ^. I have used the SortedList with the ^ and gcnew and it...
4
10116
by: SHEBERT | last post by:
Here is an example of a SortedList that works as a datasource to the ComboBox and a generic SortedList<that does not works as a datasource to the ComboBox. Why? If I use List and generic List<>, both works. private void Form1_Load(object sender, EventArgs e) { System.Collections.SortedList QA1 = new System.Collections.SortedList();
4
6761
by: semedao | last post by:
Hi, I want to implement list of key-values that can be sort by 2 ways. let's say that in the first step I wanted to make SortList based on Key = int index that cannot change and Value is another SortedList like this: class OtherSortedList : SortedList { ..... int GetTotalAmountOfAllItems().... }
1
3896
by: raylopez99 | last post by:
I seem to get name collision between the Generic collection SortedList and C++.NET Framework collection SortedList. How to resolve? Here are the libraries that seem to clash: System::Collections::SortedList, System::Collections::Generic::SortedList, using namespace System::Collections; using namespace System::Collections::Generic; ...
1
1177
by: xzzy | last post by:
1 - namespace myNS 2 - {internal class clsClass 3 - { 4 - SortedList mySL1 = new SortedList(); 5 - SortedList mySL = SortedList.Synchronized( mySL1 );
8
1248
by: shapper | last post by:
Hello, I am working with VS 2008 and created a Web Application Project. I added a class but whatever I do the class is not visible to my aspx pages or anywhere else. I then changed the property Build Action in my class from Content to Compile. Now it is recognized.
0
7836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
6606
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2343
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1447
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.