DataSource Controls :: Repeating A Nested (or Sub) Query For Multiple Categories?

Jul 10, 2010

I'm trying to design a page that displays all suppliers by their location. I'd quite like this to work from a query that will automatically include new locations added in the future.

At the moment my design has a table that holds 'locations' with locationID and locationName fields. In my 'suppliers' table I also have a locationID to join them.

I'm not sure how to query the database to return all the suppliers in location 1, then all in location 2. (Or even sure of the terms I need to Google to get some examples!) For example:

Location 1
Supplier 1
Supplier 2
Location 2
Supplier 3
Supplier 4

View 3 Replies


Similar Messages:

DataSource Controls :: Add Unlimited Categories And Sub Categories?

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

DataSource Controls :: Use Nested Query In Objectdatasource.FilterExpression?

Jan 30, 2010

I was wondering if I could use something like :

ObjectDataSource1.FilterExpression = " (ID in (Select ID from TablewithIDs where User = '{0}')) "

I am getting this error:

Syntax error: Missing operand after 'ID' operator.

View 1 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

Multilevel Nested Product Categories Display With C# And Sql Server?

Jun 9, 2010

I have a product category table with the following fields:

cat_id (PK)
Cat_name
Cat_desc
Parent_Cat_Id

Now when a user wants to add a product he should be able to select multiple categories from a listbox(multiselection enabaled). But to let the user know the hierarchy of the categories, I need to display them in the following style:

parent category 1
parent category 1->sub category 1
parent category 1->sub category 1->sub-sub category 1
parent category 1->sub category 1->sub-sub category 2
parent category 1->sub category 2
Parent category 2.........

I know that to achieve this I need to use recursive programming. But how can we do it via stored procedures?

View 2 Replies

DataSource Controls :: Multiple Like Statements In One Select Query

Mar 15, 2010

I need to write a select query where it will be doing "like" on one column with multiple strings.

Eg : Select * from tblCity where city like '%ABC%' and city like '%XYZ%'

I have set of strings.

View 5 Replies

DataSource Controls :: How To Optimize Query With Multiple Inner Joins

Mar 22, 2010

I have one question regarding how to make the below mentioned type of query more optimized so that mine query perfomace can be increased.

Select a.name1,a.address1,b.field3,c.field4,d.field6,e.field7
from a
inner join b on a.id=b.id
inner join c on c.id=b.id
inner join d on d.id=c.id
iner join e on e.id=d.id
union all
Select a1.name1,a1.address1,b1.field3,c.field4,d.field6,e.field7
from a1
inner join b1 on a1.id=b1.id
inner join c on c.id=b1.id
inner join d on d.id=c.id
iner join e on e.id=d.id
union all
Select a2.name1,a2.address1,b2.field3,c.field4,d.field6,e.field7
from a2
inner join b2 on a2.id=b2.id
inner join c on c.id=b2.id
inner join d on d.id=c.id
iner join e on e.id=d.id

All the above three select query at last using the same inner join condition, means last two inner join condition are the same for all the select query.

Is there any way so that this query can be optimized?

View 2 Replies

DataSource Controls :: Using Multiple Values In A Parametrized Query?

Aug 13, 2010

SELECT ClientMaster.ClientName,*
FROM ProjectMaster LEFT JOIN ClientMaster
ON
ProjectMaster.ClientCode=ClientMaster.ClientCode
WHERE
ProjectMaster.RefCode IN (@refcode) AND ProjectMaster.ProjectStatus=@status

@refcode should be able to contain multiple values but how should I pass value to the parameterized query?

I have tried many ways such as @refcode = 'VALUE1','VALUE2', @refcode = VALUE1,VALUE2 but to no avail?

View 3 Replies

Forms Data Controls :: When 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?

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

DataSource Controls :: Repeating Data In Stored Procedure Result?

Jan 27, 2010

I am bulding a dvd catalog and have a table called DVD which holds all my details about each dvd except Genre, Director and Actor as I want more than 1 Genre, Director, Actor per DVD so put these in seperate tables to avoid repeating the data and used a joining tabe to join the tables so the tables I have are

DVD, Genre, Director, Actor, DVDGenre, DVDDirector and DVDActor

I have now written a stored procedure to pull the info about 1 DVD out of all the tables to display on the webpage I have now got the info I want out of the tables but as the data is now in 1 table I have repeating data is there a way to stop the data repeating the stored procedure i have written is

[code]....

View 8 Replies

SQL Server :: Select Query Is Repeating Records

Jan 3, 2011

I have an SQL 2005 db with a table named "industry_suppliers."

I've created a query to enable someone to search this table using 3 parameters.

The results need to be grouped by "product_description" (which is essentially a category). When displayed on an .aspx page, for example, the results need to look like this:

Apples

Acme Apple Company
Bradbury Orchards
Oranges
A1 Citrus Company
Belfast Growers, Inc
Bradbury Orchards

Notice how "Bradbury Orchards" is repeated under both categories. This is the result I want, EXCEPT in cases where someone wants to filter the search results by category. Let's say someone wants to search just for apple suppliers. The problem I'm having is that any record that appears under apples will also get listed again under any other categories associated with that record. So, searching for apple suppliers, the results are this:

Apples
Acme Apple Company
Bradbury Orchards
Oranges
Bradbury Orchards

I'm having trouble figuring out how to revise my query to avoid this problem.

[Code]....

View 4 Replies

DataSource Controls :: Retrieving List Of Categories For A Post?

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

WCF / ASMX :: Webservice With Repeating Parameters In Query String

Mar 3, 2011

I am consuming a web service in .aspx with a added web reference that links to http://www.webservicex.net/stockquote.asmx After this, I can get the result from
ebServiceX.StockQuote ws = new WebServiceX.StockQuote();String xmlString = s.GetQuote("XOM"); I am wondering how I can call the web service like GET, http://www.webservicex.net/stockquote.asmx/GetQuote?symbol=XOM+BAC

View 1 Replies

DataSource Controls :: How To Pass Multiple Values And Execute Query In Stored Procedure

Jun 2, 2010

basically i have two dropdown boxes to filter data and textbox with stored procedure bound to gridview.i want to be able to query data depending on the selected value passed,either using one or more parameter values.

i would like seperate sqlcommands to chose from depending on which controls i select to pass parameters.

i have included a parameter Select(control id) as this is declared by the wizard for stored procedure.

but i am not sure how it is defined on the page and passed to procedure.

[Code]....

View 2 Replies

ADO.NET :: Not Duplicate / Query A Products Table Based On Categories Selected By The User?

Feb 22, 2011

i posted a question yesterday but it got taken off by moderator mbanavige with the reason indicating it was a duplicate post. i know for sure it was the first time i was asking that question. i will have to ask it again NOW because it was deleted. hope THIS one does not duplicate the one i made yesterday. so here goes:

I need to query a products table based on categories selected by the user. The selection of the categories is a checkbox list, and user can select any number of categories (including none at all). I only know how to compare one parameter at a time. Like this:

[Code]....

View 3 Replies

ADO.NET :: LINQ Multiple Categories For Product?

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

Submit Repeating / Multiple Items To Stored Procedure Via Webservice

Mar 7, 2010

I am trying to what i think is an easy task, but so far i have came up empty.

What i want to do is take a repeating table on a form i have and submit the employee IDs to a database using a web service.

I know how to submit them one by one, but i am thinking there is an easier way to do this instead of send the value to the web service, submit thee data, and then go till the last record.

I am currently using this:

<WebMethod(Description:="sends employee id to database")> _
Public Function SendMultiple(ByVal strEmployeeID as string) As String
Dim sqlCon As New SqlConnection()
Dim sqlCmd As New SqlCommand()
sqlCon.ConnectionString = "connection string information"
If sqlCon.State = ConnectionState.Closed Then
sqlCon.Open()
End If
sqlCmd.CommandText = "spInsertMultiple"
sqlCmd.Connection = sqlCon
sqlCmd.CommandType = CommandType.StoredProcedure
Dim Parameter0 As SqlParameter = New SqlParameter("@EmployeeID", strEmployeeID)
Parameter0.Direction = ParameterDirection.Input
sqlCmd.Parameters.Add(Parameter0)
Dim dr As SqlDataReader
dr = sqlCmd.ExecuteScalar
Dim strReturnedValue As String = "hello"
Return strReturnedValue
End Function

View 6 Replies

MVC :: Entities Data Models With Multiple Categories Using A Membership Table?

Sep 18, 2010

(Using SQL Server 2008 and ASP.NET MVC2)I have a simple business table and a category table. I have a 3rd table to map business to category, a many-to-many relationship. the Map table contains a BusinessID and CategoryID. I'm lost as to how I can load the categories into my Business View Model using the entities model.Without incorporating categories, my code looks like this:

[Code]....

with Business View Model defined as:

[Code]....

but if i want to populate the Categories with the mapped categories, how would one do that?

View 1 Replies

DataSource Controls :: SqlDataSource And Parameters Query / Trying To Accomplish Is Building Dynamic Query

Aug 22, 2010

1. I have a GridView on my page and it uses sqldatasource with parameterized query. What I want to do is, on page load (where nothing has been selected so no parameter supplied), I want it to query everything (something like SELECT * FROM [this_table]) but since my SelectCommand is something like

SELECT * FROM [this_table] WHERE [this_column] = @someParameters AND [that_column] = @someParameters.

Can I play around with default value to achieve something like that but how ? Now, when the page loads, it doesn't show anything (No Gridview).

2. On my page, I made something like (username, gender, address, and more) and one single search button. That means, no single control enable auto postback. What I am trying to accomplish is building dynamic query

(if username specifed -> SELECT * FROM [this_table] WHERE [username] LIKE @username).

If both username and gender are specified (SELECT * FROM [this_table] WHERE [username] LIKE @username AND [gender] = @gender) and you know the rest. How can I do this using GridView and SqlDataSource ? To my knowledge, I can only specify one SELECT statement in a sqldatasource.

View 11 Replies

DataSource Controls :: Update Query Not Working When Using Query Builder To Configure Table Adapter

Jan 15, 2010

[code]...

This query works perfectly on the query analyser.

But when configuring the Table adapter ,I try executing the query and i get 0 rows affected.

What could I be getting wrong in this case.

NB:Existing GalleryID has been supplied.

View 1 Replies

DataSource Controls :: Can't Find Query's / By Right Clicking On Database Created A Query In Server Explorer?

May 17, 2010

By right clicking on my database i created a query in server explorer. But where are this query stored can't find them back. I should aspect that their is a folder query's like there is a folder tables but this isn't the case.

View 10 Replies

Data Controls :: Nested GridView (Multiple Levels)

Mar 3, 2013

I found the article about Nested GridView Example in ASP.Net using C# and VB.Net

I tried it with a third level, but have problems of binding data. How it could work?

<asp:GridView ID="gvCustomers" runat="server" AutoGenerateColumns="false" CssClass="Grid"
DataKeyNames="t1000_customer_id" OnRowDataBound="OnRowDataBound">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<img alt="" style="cursor: pointer" src="./images/plus.png" />
<asp:Panel ID="pnlOrders" runat="server" Style="display: none">

[CODE]...

View 1 Replies

DataSource Controls :: How To Convert Sql Query Into Linq Query

Mar 10, 2010

select Groupid,GroupName,onorusername from palgroup where groupid in (select distinct Groupid

View 5 Replies

DataSource Controls :: Accessing FK From A Query Via Entity Query

Jan 21, 2010

I've got a query such as

Dim MediaQuery =
From m
In dB.DOWNLOADS _Where m.ID = id _Select

which returns a record from the database. One of the fields in the record is a FK to another table. I need to read this value to be able to set a dropdown based on the ID but I can't work out how to access it. For a standard record I can just do the following txtTitle.Text = MediaQuery.FirstOrDefault().TITLE

However with the foreign key it doesn't work like that. I've tried drpGroup.SelectedIndex = MediaQuery.FirstOrDefault().DOWNLOAD_GROUPS.ID where DOWNLOAD_GROUPS is the FK field but it returns Object reference not set to an instance of an object. If you're simply wanting to read some values from a single db record in the entitiy framework and one is a foreign key how should I go about getting the value?

View 2 Replies

Forms Data Controls :: Editable Multiple Nested Gridview

Aug 19, 2010

I've got this page where I display a 3 level nested gridview. First gridview displays data, 2nd one displays data based on the 1st one's row and 3rd one displays data based on the 2nd gridview. All of this works perfectly, including the edit mode for the 3rd gridview.

The issue comes when I make each gridview collapsible, again, it works fine but when I click on "Edit" on the 3rd gridview all the grids collapse, I can then re-open them and the "edit mode" is still present and I can still save my updated data. But that collapsing thing is quite annoying. I based a lot of my code from this page: [URL] And I understand how I can fix my issue on a 2 level nested gridview, by simply adding the C# code:

[Code]....

This makes allows me to save the index and prevent it from collapsing when I'm editing. Unfortunately, because I'm actually editing the 3rd gridview, if I code:

[Code]....

That simply doesn't work because I get the error "GridView2 does not exist in the current context". I also tried adding it to the .designer.cs page, but that doesn't change anything and still doesn't work. I'm not at work atm, and hence cannot paste the entire code, however, would anyone still have any idea as to how I can fix that issue?

View 11 Replies







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