Portal Engine
Version 2.x > Portal Engine > Alphabet directory View modes: 
User avatar
Member
Member
Chunda - 5/24/2007 3:28:26 PM
   
Alphabet directory
I want to provide a page like:

A B C D E F G ... Z

and when the user clicks the button, (or link) of the letter the list of related documents with the name starting with the chosen letter are shown in a table below.

Whats the way to do this?

Do I need to create a custom control for the letters selector?

Thanks
Chunda

User avatar
Kentico Product Management
Kentico Product Management
kentico_karolj - 5/24/2007 5:34:54 PM
   
RE:Alphabet directory
Hi Chunda,

One solution could be write function that would find out what directory (node in content tree) user selected. According to node id you would call appropriate method to filter only documents starting with selected letter.

Best Regards,
Karol Jarkovsky

User avatar
Member
Member
Chunda - 5/24/2007 6:48:01 PM
   
RE:Alphabet directory
I created a custom web part in the end (once I found the Product value drop dwon list example in the help for some guidence). I used an array of buttons. Using the onclick I set a web part property to the appropriate 'where' clause for the document type I am using.

I then used the Bindings section of the repeater to link the document list to the selected letter/button that was clicked.

Thanks

User avatar
Certified Developer 8
Certified Developer 8
richard - 3/6/2012 11:15:48 AM
   
RE:Alphabet directory
This is a really old post but I found this article really helpful:

http://www.codeproject.com/Articles/3628/Letter-Alphanumeric-Based-Paging-in-ASP-NET

I used the UsersViewer.aspx and its attached UsersFilterControl.ascx

I created a public property in the Filter to pass the Users data source to the filter


public object UserDataSource
{
get
{
return mDataSource;
}
set
{
mDataSource = value;
}
}


And passed it to the filter control (about line 720 of UsersViewer.aspx - note do this after the initial WhereCondition has been applied to the UsersDataSource):


filterUsers.UserDataSource = srcUsers.DataSource;



In the letters_Bind() method from the above article I changed the binding so that it only shows the letters from users that we have in our datasource.


InfoDataSet<UserInfo> uds = (InfoDataSet<UserInfo>)this.UserDataSource;
Hashtable htUsers = new Hashtable();

foreach (UserInfo dr in uds)
{
string firstLetter = dr.LastName.Substring(0, 1).ToUpper();

if (!htUsers.ContainsKey(firstLetter))
{
htUsers.Add(firstLetter, firstLetter);
}
}


In the filter I changed the letters_ItemCommand (from the above article) to the below:


if (_letterFilter == "All")
{
WhereCondition = "";
}
else
{
WhereCondition = "Upper(LastName) like '" + _letterFilter + "%'";
}

// Raise OnFilterChange event
RaiseOnFilterChanged();