Web Forms :: Split The Treeview Into Sub-Categories?
Feb 22, 2010
This may be a fairly complex question but I'll try to make it as simple as possible.
I have 2 treeviews, the 1 has a single hierarchial structure like this:
Parent
-->LevelOne
---->LevelTwo
-------->LevelThree
------------->LevelFour
But the second treeview must populate defining sub-categories from the database onto the tree like this:
Parent
-->Sub-LevelOne
---->LevelOne
------->LevelTwo
------------LevelThree
-->Sub-LevelTwo
---->LevelOne
------->LevelTwo
------------LevelThree
My problem is after I've defined the second sub-level structures, I get duplicated sub-levels of data within the sub-level nodes as opposed to having the data distributed between the 2 sub-nodes with the appropriate corresponding data assigned to each level.
In my database, the 2 top sub-levels are identified by integer values of 1 and 2. So the first 2 sub-level nodes are created using a case statement which creates 2 separate sub-level nodes on the tree as I need. But I am having a problem for how I can get the next levels of data to distribute between the 2 separate sub-levels accordingly???
Its almost like I need a 2 more treeviews within a treeview to accomplish what I'm after but I don't know if this is even possible.
View 4 Replies
Similar Messages:
Jan 9, 2010
I want to add unlimited categories and sub categories facility, But I couldn't solve it for last two days.
1. DB
CategID,CategName,parentid
Data:
CategID CategName Parent ID
1 Electronics 0 (where 0 means it is main category)
2 TV 1 (Self Join whith the categ id Electronics)
3 Panasonic 2
4 LG 2
5 Toys 0
6 Girls Toys 5
7 Boys Toys 5
8 Criket Related 7
9 Dolls 6
Here I want to display this data in Combo Box like
Electronic
>>TV
>>Panasonic
>>LG
Toys
>>GirlsToys
>>Dolls
>>Boys Toys
>>Criket Realted
View 6 Replies
Mar 1, 2011
Periodically a rash of occurrences of the following error happen. I believe they're the result of hack attempts. Whether that's the case or not, my question is how can I handle the error? I want to avoid unhandled exceptions. The TreeView control is just
a standard .Net TreeView control, not a custom one. If you suggest a code solution, please code it in VB.Net as that's what I'm using.
Message: Input string was not in a correct format.
Stack Trace:
at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal)
at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info)
at System.Web.UI.WebControls.TreeView.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.WebControls.TreeView.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection)
at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
View 3 Replies
Nov 15, 2010
I have a treeview which will be generated dynamically which need to be displayed on left side and when user clicks on a node it need to open a page on the right side of the same page. and each node has different aspx page. so whenever user selects a node the page details should be displayed on the right side .we can use an iframe on the page which will display the different pages clicked on the node.Is there any alternative i can use to display different pages based on the user selection on the right side without using iframe.
View 5 Replies
May 7, 2015
Code to drag and drop a TreeNode to another control or tag such as Div or even another TreeView.
View 1 Replies
Jul 28, 2010
Is there any way to have the gridview page by categories instead of pages. In other words instead of at the bottom having some sort of page numbering scheme there would be categories from a specific column (kind of like a group by in sql) arranged along the bottom and when I would click one it would page to the start of all those matching rows (preferably return all of them rather than just say 10 or 20).
View 1 Replies
Dec 8, 2010
i have one requirement like i want to show all the categories with the subcategories ..
i mean if i have the Sale category it will be heading of the gridview and all sub categories of the Sale category foreign key related subcategories display in that gridview like urls .same way it will show all the categories ..
View 7 Replies
Mar 30, 2012
sample code for datalist to display the categories and forum like used in a aspsnippet forum
View 1 Replies
Jun 8, 2010
I have a repeater that displays a list of job openings. I now need to modify the repeater and break out the job openings by category.
See below for the existing code for my repeater. I'm not sure how I need to modify my repeater to display the jobs under the appropriate categories.
I've added a new JobsCategory table to the database and added the foreign key relationship between my jobListing table and the jobcategory table.
I've created a new stored procedure to pull the jobs my category:
CREATE PROCEDURE [dbo].[GetJobsByCategory]
@categoryId int
AS
BEGIN
SET NOCOUNT ON
SELECT j.JobID, j.JobTitle, j.URL, j.City, j.State, j.Country, c.CategoryName
FROM ADPJobListing j
INNER JOIN ADPJobCategory c ON j.CategoryID = c.CategoryID
WHERE j.CategoryID = @categoryId
END
In my typed dataset (tableadapter), I'll add a new query to the above stored procedure and finally in my business logic layer, I'll add a new method to call down into my data access layer:
[DataObjectMethod(DataObjectMethodType.Select, false)]
public ADP.JobsDataTable GetJobsByCategory(int categoryId)
{
return this.Adapter.GetJobsByCategory(categoryId);
}
How do I need to modify my repeater to display the jobs by category?
[Code]....
View 1 Replies
Sep 2, 2010
i have a problem about listing. i have categories that it is added infinite category,subcategory. Table is like that:
id
ustid
kategori
seviye
i want listing like this:
For example when i click "Arac", the list will become like following:
Araç (category)
Otomobil (subcategory)
Motorsiklet (subcategory)
Then .when i click "Otomobil"
Araç
Otomobil
----Fiat
---Audi
---BMW
when i click "Fiat"
Araç
-Otomobil
--Fiat
---Murat
---Şahin
View 3 Replies
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") + " " + 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
Feb 18, 2010
how to write Css for asp.net treeview by applying color and theme like (msdn website treeview)?
View 1 Replies
Nov 7, 2010
I am having problems in getting product data when using different levels of categories. My knowledge of SQL is also very limited.
Here is what i have so far
TABLES
Categories
CategoryID (PK) int
CategoryName nvchar(max) allow null
ParentID int allow null
Data for this table
1,Soaps,null
2,Original Range,1
3,Premium Range,1
4,Speciality Range,1
5,Seasonal Collection,4
6,Selection,4
Products
ProductID (PK) int
ProductName nvarchar(max)
ProductDescription nvarchar(max) allow null
ProductPrice money
CategoryID int
Data for this table
1,Prod1,some text,0.25,6
2,Prod2,some text,0.25,6
I have some linq to sql in the page load event that populates a list view,
[Code]....
Now when the category passed in from the query string is 6 then the products with a category of are shown correctly but category 6 is a child category of 4 and 4 is a child of 1 so when i pass in 4 as the category i should still be retrieving the data for products 1 and 2.
View 4 Replies
Jan 6, 2010
I have a parent repeater that lists the sections of the website. this repeater binds to display a table that contain another repeater of the website pages .. or may display a table that contains another two repeaters of the projects categories and sub-categories.Until now everything is going fine.
The problem comes when I try to include a query of the section ID to the link of the project categories (DataView of the projects repeaters does not contain SectionID)my question is : is there any way to call the SectionID of the first repeater in my projects categories and sub-categories repeaters?Here is my code:
[Code]....
the code behind is as follow:
[Code]....
View 8 Replies
Feb 6, 2011
I have a class
public class CountryListViewModel
{
public IEnumerable
Countries { get; set; }
}
public class CountryViewModel
{
public string CountryName { get; set; }
public string State { get; set; }
public IEnumerable<CityViewModel> Cities {
get; set; }
}
public class CityViewModel
{
public string CityName { get; set; }
public string CityLink { get; set; }
}
using linq to entity grouping by country and it works as designed. but I also have to group by state.
var query = from c in _db.MyTable
where c.IsActive && c.Country == country
group c by c.Country
into loc
select new CountryViewModel()
{
CountryName = loc.Key,
Cities = loc.Select(s => new CityViewModel() { CityName = s.City, CityLink = s.City }).Distinct()
};
View 2 Replies
Oct 8, 2010
I have my categories in database, and want something url rewriting/routing to make my url nicer and more SEO friendly. I have divided my categories into the following:
Cars > Select car > Car model >
how do I create url rewriting / routing in my categories? I use framework 4.0
View 1 Replies
Jan 27, 2011
I'm using Entity Framework.
I have 3 tables:
- Products (Primary key productId)
- Categories (Primary key categoryId)
- Product_to_categories (Table with two fields, CategoryId and ProductId)
One product can be assigned to multiple categories.
How should I download the products from specific category?
Now I retrieve them in that way:
int PageNum = 1;
int PageSize = 10;
int categoryId = 5;
var categoryModel = db.Categories.FirstOrDefault(c => c.CategoryId == categoryId);
var results = (from p in categoryModel.Products select p).Skip((PageNum - 1) * PageSize).Take(PageSize).ToList();
But when there is a lot of products in category my server crushed. I want only 10 products per page.
View 2 Replies
May 12, 2010
I have few monhts working with aspx, and now I'm developing a shopping cart website. For the employee to upload the products on the DB, every product needs to be linked to a category and sub category, and sub-sub category, and so on. Sometimes the sub-sub categories are up to 5. For example Electronics-TV-LCD-Samsung-40 inches.
First, What I would like to identify is if the SQL table has the apporpiate structure. I have 3 columns Id, Description, Parent_Id. Categories with Parent Id=0 is used for the top ones. Is this the best way to do it?
Then I want to use the ListBox control to select main Categories, and once it is selected, filled a second listbox with its childs and so on. Do I need to query SQL DB everytime the change event happens? I heard about linq but have not used yet.
View 1 Replies
May 14, 2010
The problem is that we have 5 different categories and we have to calculate the percentage of products sold in each category. Then we have to show that in sort of a chart. The interface of chart is shown here
http://img64.imageshack.us/img64/5397/52805880.gif although this chart has 14 boxes but I will be using 20 boxes in the final chart, the reason for that is that I want each box to represent 5% of sales. Now the question is suppose that the percentage for sales in each category is 34.4%, 12.6%, 23.2%, 22.6% and 7.2%. How do I convert these values to nearest 5 and then fill each box with that color. For example 34.4% means that almost 35% or 7 boxes will be colored with that color. The problem is that the sum of all of these must always be 20. I understand that this will not be very precise representation but this is the demand from the user.
View 4 Replies
Dec 16, 2010
I am trying to create a search filter much like the one used on eBay that dynamically comes up with appropriate search categories based on the search results left. For example: [URL]
As you can see the search filters on the left are based upon the details displayed on the product results.
I need to try and implement something similar for an ASP.NET site, whereby I need to filter articles based on fields such as sales, companies, employee numbers etc. My database is quite normalised so I am able to separate all the data into their own tables.
View 1 Replies
Mar 18, 2011
I have a categories table which is set up to allow an infinite number of sub category levels. I would like to mimic the following:It should be clarified that sub categories can have sub categories. E.g. Parent cat -> level 1 -> level 2 -> level 3 etc.My categories table has two columns, CategoryName and ParentID.This list box will be used when assigning the correct category to a product.How can I write this?EditIn response to thedugas I had to modify your answer to work with my situation. I found some errors that needed to be fixed, but below is a final, working solution.
protected void Page_Load(object sender, EventArgs e)
{
using (DataClasses1DataContext db = new DataClasses1DataContext())
[code]...
View 3 Replies
Feb 24, 2010
I would like to create a category page in the admin section where the admin can create/add category from the webpage , he/she don't have to go to database to create it how to make this possible by sourcecode in webpage and in database?
View 12 Replies
Mar 12, 2010
I am trying to put a list of categories on my shared master page, I have it working by passing my list of categories to the shared master page in a viewdata[] object - Problem I have is I now want to loop through and out put the links to my categories (Which I am doing this)
[Code]....
View 3 Replies
Mar 16, 2010
I have a multilevel Category Table, like so
CategoryID, CategoryName, ParentCategoryID, IsMainCategory
I want to be able to loop through all the categories starting with the Main Categories and then go all the way down for example I could have
[code]...
I wanted to be able to loop through ALL categories in order like above programatically - This is how far I got
[Code]....
But I hit a stumbling block.. I just wanted to check I am tackling this the right way? Or is there something simple I'm missing?
View 2 Replies
Jun 4, 2010
I have a ListView inside my UserControl which is showing a list of posts from the table named posts. I've also got a category table which is full of the categories. I then have another table which contains the PostID and the CategoryID so that posts can have multiple categories. I was wondering, in my ListView at the moment I only have a list of the posts but I would like to add, for every post in the listview, the cateogires it is in.
View 12 Replies