C# - Order A List / No Other Fields Associated With A Category?

Oct 26, 2010

I have a function in sitefinity that returns a list of categories.

//return list of categories
private IList<ICategory> GetCategoryDataSource() {
var cntManager = new ContentManager(CaseStudyManager.DefaultContentProvider);
IList allCategories = cntManager.GetCategories();
List<ICategory> filteredList = new List<ICategory>();
foreach (ICategory category in allCategories) {
filteredList.Add(category);
}
return filteredList;
}

What I want to know is how to sort this list.

Categories in Sitefinity are as far as i can tell just a string, there are no other fields associated with a category. Therefore I have nothing to sort the categories on, other than appending each category with a number, like:

1 - Legal
2 - Financial
3 - Property

When these categories are displayed on the website I can then at least trim the parts i need.

View 2 Replies


Similar Messages:

How To Change Order In Category

Jun 17, 2010

I am buiding web application about news.My problem i need to change order of articles in that category.
Example :

+ Article A ----> position 1
+ Article B ----> position 2
+ Article C ----> position 3
+ Article D ----> position 4
+ Article E ----> position 5
+ Article F ----> position 6

All articles A -> F are inside category. Sometime i want to Article E is position 1, or article C in position 6 ...and so on Now i can't imagine what i have to do ?

View 9 Replies

JQuery :: Reorder List - Change Order Of Divs And Upload New Order To Database

Feb 7, 2011

The AjaxToolkit has a ReorderList. I'm searching for a jQuery solution that does the same and found this page. I would like to change the order of divs (vertically) and upload the new order to the database (ajax).

View 2 Replies

Web Forms :: Error Connection From Category List To Product List?

Dec 9, 2010

<a href='<%# VirtualPathUtility.ToAbsolute("~/ProductsList.aspx?CategoryId=" + Eval("CategoryID")) %>'><%# Eval("CategoryName") %></a>

it bring me this error Conversion from string "~/Products.aspx?CategoryId=" to type 'Double' is not valid.

View 1 Replies

Forms Data Controls :: Show Certain Input Fields Depending On Category Selected?

Mar 21, 2010

What would be the best way to handle the following scenario? I have an application where depending on what type of proceeding is selected, only certain input fields should be visible.

There are 33 proceeding types and 14 input fields in total

First case, make one big form with all of the fields and have a dropdown with proceeding type which depending on what is selected, makes certain fields visible?

View 5 Replies

C# - Creating A List Of Dataset Fields And Form Fields For Easy Updating?

Feb 25, 2011

I have a relatively complex dataset (numerous tables, some with multiple records) generated from reading in an XML file. I need to connect said dataset fields to an ASP form. At the moment I'm assigning them manually, like so in the pageload:

txt_first_init.Text = formData.ds.Tables["phrmHdrKey"].Rows[0]["first_init"].ToString();
txt_last_name.Text = formData.ds.Tables["phrmHdrKey"].Rows[0]["last_name"].ToString();
ddl_pregnancy_flag.SelectedValue = formData.ds.Tables["pPhrm"].Rows[0]["pregnancy_flag"].ToString();

And conversely when it's time to submit.

formData.ds.Tables["phrmHdrKey"].Rows[0]["first_init"] = txt_first_init.Text;
formData.ds.Tables["phrmHdrKey"].Rows[0]["last_name"] = txt_last_name.Text;
formData.ds.Tables["pPhrm"].Rows[0]["pregnancy_flag"] = ddl_pregnancy_flag.SelectedValue.ToString();

I did some looking into binding the textboxes (and dropdownlists, and checkboxes, and and and...) directly, but it seemed to be too many formats to use.

So this works fine, but as the number of fields increases, those load and unload lists are going to get unwieldy.

View 1 Replies

Put Database Fields In Order

Aug 5, 2010

i am working with a database to create a website i know how to display the data into tables on my website but is there a way of changing the database layout when a button is pressed. i.e. so that when a button is pressed on the website the program sorts all of the first names into order (A to Z) in the database - so that the information is displayed A to Z

View 4 Replies

How To Create Category And List In One Query With Linq

Jun 20, 2010

I want to create something like this using a DataList and Flow markup:

|-----------------------|
| Title |
|-----------------------|
| [x] Title |
| [x] Title |
| ... |
-------------------------

I have a table (modeled in Linq2Sql) Foo that has these fields

int id;
int? parentId;
string title;
Foo Parent;
EntitySet<Foo> Children;

Now, when there is a null parent, it means it's a top level category, and if the parent has a value, it's part of the category list.

I have created a DataList, and used a LinqDataSource with a query that looks like this:

[Code].....

This obviously doesn't work. How can I utilize the Children collection in a repeater of a DataList item?

View 1 Replies

JQuery :: How To Create List Order And Unorder List Using Data Table

Oct 21, 2010

1 My DataTable Return following Data

Acct Books Annual
Acct Books Monthly
Acct Tax Income Tax
Admin GH Eqpt
Admin Offc Eqpt
Admin Offc Misc
Admin Offc Eqpt
[code]...

View 10 Replies

C# - Set Order Of Appearance For Fields When Using Html.EditorFor In MVC 2?

Mar 9, 2010

I have the following classes in my Model:

public abstract class Entity : IEntity
{
[ScaffoldColumn(false)]

[code]...

View 1 Replies

ADO.NET :: Entity Framework 3.5 / Select Category From Dropdownlist Bind Gridview To All Products Related To This Category?

Nov 5, 2010

i create example using Northwind database so i create a new website and add new ADO.Net Entity Data Model (.edmx) called Northwind.edmx and i add Categories and Products table inside this (.edmx) file

and add new ADO.Net Data Servuce called "ADODataService" and add it as WebReferences called NorthwindService

so i add new web page and drag DropdownList and Gridview as i want to bind Dropdownlist to all categories and when i select category from Dropdownlist bind Gridview to all Products related to this category

so my code

[Code]....

and my code
[Code]....

so when i select category from Dropdownlist nothing happen :(

also you will find commented code in method BindCategory whuch is not work also.

View 1 Replies

Get An Error A String (selected Category In The Ddl) Cannot Be Converted To A Category Object?

Feb 7, 2010

I'll try to explain as simple as I can in text what my problem is. I don't see any other way to make my issue clear.

I have a GridView that uses an ObjectDataSource.

The ObjectDataSource has an DataObjectTypeName defined, so I pass/get complete objects or list of objects to/from the data access methods.

The objects I'm working with, let's say we work with Book objects, contain a Title and a Category, BUT the Category is an object itself. When the Select method is called, we get a List of Book objects, which is perfectly displayed, overridden ToString method in the Category objects within the Book objects.

The problem I face is that I can't find a way to update the category in my GridView. What I did already accomplish is:I used a template field in the GridView for the Category so I could use a DropDownList for that field in Edit mode.

I bound the DropDownList to another ObjectDataSource that gives me a list of CategoryObjects.

So when I enter Edit mode... the row shows a nice ddl with the available categories. It even selects the right original category.

So far so good... but when I want to save my new selection, I get an error that a string (the selected category in the ddl) cannot be converted to a Category object (that's what the Book object, that is going to be used for the update, expects).

View 5 Replies

Forms Data Controls :: How To Display Category Name Without Category Id

Mar 30, 2011

I am working in a project that is a musical website. I want to display the web page with all categories I have. In my database , named Category_Master, I have two fields like Category_Id (which is a primary key ) and Category_Name. I have generated category_Id with NEWID() function. The category_Id is not supposed to display on the web page. But, i have to select Category_Name and according to that , I have to get the category_Id. If I am using Static connection with SqlDataSource, i am able to make visible=false property so that the category_id won't be visible. But , at that time, I can't write code to Select the category_id of the selected index.

If i am using disconnected approach, I filled the dataset with the Category_Master, and binded it to GridView. But, at that time, I can't hide the category_id from the user. I want to select category_id by clicking on the category_name with out displaying category_id ..?

View 4 Replies

Forms Data Controls :: Nested Repeater: Rewrites Ending Category List To All Categories

Feb 11, 2011

Nested Repeater Issue: Each category list gets populated with the same set of date values rather then being populated with the data associated with that category. Trying to Do: Trying to group FAQ's by category and then list them using the repeaters.

The data is queryed though a business logic layer object that makes a call to the data access layer object. The data access layer object uses linq to sql to return data. There are 3 parameters that are passed into the innerDataSource's ObjectDataSource control to populate the nested repeater control (propID, CatID, isVisible).

With the debugger, the correct data is being returned and written to the nested repeater firing from the nested repeater's ItemDataBound event. Once this event is finished, another event fires and runs the FAQRule object again on the business logic layer which re-populates the nested repeater with the same data for each category. I have 2 repeaters, outerRepater (parent) and innerRepeater(child) with 2 ObjectDataSource controls innerDataSource and outerDataSource. See code below : ASP Page:

<asp:Repeater DataSourceID="outterDataSource" EnableViewState="false" runat="server">
<ItemTemplate>
<%# Eval("Description") &#43; " " &#43; this.Property.PropertyName %>
<asp:Repeater EnableViewState="false" runat="server" DataSourceID="innerDataSource">
<HeaderTemplate>
<ul style="width: 500px">
</HeaderTemplate>
<ItemTemplate>
<div><%# Eval("Question") %></div>
<div><p><%# Eval("Answer") %></p></div>
</ItemTemplate>
<FooterTemplate>
</ul>
</FooterTemplate>
</asp:Repeater>
<asp:ObjectDataSource ID="innerDataSource"
runat="server"
SelectMethod="FetchFAQSByPrpAndCatID"
TypeName="PropertySite.BusinessRules.FAQRules">
<SelectParameters>......................................

View 3 Replies

How To Order List By String Value

Sep 7, 2010

I need to order a list of items, by a string value...

e.g. 635, 955, 5820, 1010 should appear as 635,955,1010,5820, however it shows up as 1010, 5820, 635, 955 because it's a string and not an integer.

I cannot convert to integer, it must eb a string value. how this can be done simply using a string value?

View 3 Replies

How To Order A TimeZone List In C#

Feb 17, 2010

I have an ASP.NET web application that requires users to select their appropriate time zone so that it can correctly show local times for events.

In creating a simple approach for selecting the time zone, I started by just using the values from TimeZoneInfo.GetSystemTimeZones(), and showing that list.

The only problem with this is that since our application is primarily targeted at the United States, I'd like to show those entries first, basically starting with Eastern Time and working backwards (West) until I reach Atlantic time.

View 2 Replies

C# - Order A Object's List?

Feb 16, 2010

i have an object's list where the object has 2 attributes, id and name. I have to order the list by the name of the objects

View 6 Replies

JQGrid Inline Editing - Filter Subcategory Dropdown List Based On Another Category Dropdown

Jul 9, 2010

I have a category and a subcategory column in a Jqgrid. I have enabled inline editing, both category and subcategory are dropdownlists columns (edittype:'select'). I need to filter the subcategory list based on the selected category. I wonder how can I acheive this functionlity? I tried the below event but its not working for me

afterEditCell: function(rowid, celname, value, iRow, iCol) {
//to do here
}

the above event doesn't get fired. my all column are editable

View 1 Replies

Sort List By Specific Order

Mar 17, 2010

If I have a specific order that I want to sort my List by, how do I do that? For instance, I have a list of items (coming from a database), with ID's ... and they come in order, i.e 1, 2, 3, 4. After receiving this list, I'd like to reorder the list above based on a specific order, e.g. 2, 4, 1, 3. How do I do this without complicate it too much?

View 11 Replies

Correct The Sort Order Of Sql Dropdown List?

Jan 5, 2010

I am trying to correct the sort order of my ASP.NET drop down list.

The problem I have is that I need to select a distinct Serial number and have these numbers organised by DateTime Desc.

However I cannot ORDER BY DateTime if using DISTINCT without selecting the DateTime field in my query.

However if I select DateTime this selects every data value associated with a single Serial number and results in duplications.

The purpose of my page is to display data for ALL Serials, or data associated to one serial. When a new cycle begins (because it is a new production run) the Serial reverts to 1. So I cannot simply organise by serial number either.

When I use the following SQL statement the list box is in the order I require but after a period of time (usually a few hours) the order changes and appears to have no organised structure.

View 2 Replies

AJAX :: Reorder List - No Changes To Order Are Visible

Sep 2, 2010

Im using a toolkit reorder list control. Im using LINQ2SQL. I have troubles making the order changes in the list to be updated to the database. This is my aspx code:

[Code]....

The drag and drop reordering works fine. In my

[Code]....

But no changes to the order are visible. What is missing?

[Code...]

View 2 Replies

AJAX :: Re Order List Items Not Moveable

Sep 24, 2010

I have been trying to get the Re-order list to work using the following tutorial (but in VB instead): [URL] The list is displaying properly, but none of the items are moveable. My code is pretty much exactly the same as the tutorial.

View 1 Replies

Web Forms :: Capture List Box Order After Javascript Change

May 13, 2010

I have a list box with 2 buttons (up and down) to determine the sort order. To move the items in the list box up or down I am using Javascript. I have a save button which is used to save the new order. However, I have an issue, in that when I have rearranged the order and press save, the order from the code behind is the same as the original order. My list box is:

<asp:ListBox ID="lstSortOrder" CssClass="uiControl" Height="200px" Width="700px" runat="server"></asp:ListBox>

My code behind to save the new sort order is:

[Code]....

What so I need to do to capture the new listbox order?

View 1 Replies

Web Forms :: Create A List Order And Unorder Using Database?

Sep 5, 2010

how to create a list order and unorder using database

View 2 Replies

Web Forms :: Is It Possible To Display The Items In A Dropdown List Not By The Order Of Insertion

Jul 7, 2010

Is it possible to display the items in a dropdown list not by the order of insertion?

i want to display the orders alphabetically.

View 3 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved