displaying multiple columns in a gridview populated from a single column

hi, i'm a newbie so my apologies in advance if i am not explaining my problem clearly... i'm happy to repost to help clarify anything.

Problem: i am not able to sort and organize my record set the way i need to to popluate my gridview. i am looking for suggestion on either how to construct my sql statement, or manipulate my gridview.

Environment: i am working in asp.net 2.0 and using a sql server db.

Details: I have a single table called Loans. i need to retrieve three columns from that table: LoanOfficer, LoanState, and LoanKey. The LoanState column contains one of three values of the state the loan is currently in (Apply, Process, or Approve). Each LoanOfficer has multiple loans assigned to him in one of those three states (apply, process, or approve). I need a gridview to list each LoanOfficer and the number of loans assigned to him in each state.

My gridview needs to display 4 columns: LoanOfficer, Apply, Process, and Approve.  Each row would have the following information: An individual loan officer would appear under the LoanOfficer header. The number of loans assigned to that LoanOfficer in the Apply state would be in the Apply column. The number of loans assigned to that LoanOfficer in the Process state would appear under the Process column. The number of loans assigned to that LoanOfficer in the Approve state would appear in the Approve column. With each new LoanOfficer, the row structure would repeat itself.

The LoanKey is a unique identifier that will be used for locating the correct record for a detail view.

I am completely lost on how to extract and group the states of the LoanState to each LoanOfficer in the manner described above. Please Help! I have found nothing on line about creating multiple columns from the data from one column.

Ideas: I have spent most of yesterday trying to construct a sql statement that would allow me to do this. so far i have had no luck. i am new to gridviews, but havent found anyway to manipulate the record set to arrange the data in the way that i need. I am also open to creating a collection and potentially binding that to the gridview. i just need help on how design the framework of something like that. Would building a View help do this...?

any suggestions greatly appreciated, thanks.


3/1/2007 8:54:56 PM
asp.net.presentation-controls 72751 articles. 3 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 39
Get it on Google Play
Get it on Apple App Store

Here you are:

You can use this SQL Select statement:

SELECT LoanOfficer,COUNT(CASE WHEN LoanState='Apply' THEN LoanState ELSE NULL END) AS 'Apply'
,COUNT(CASE WHEN LoanState='Process' THEN LoanState ELSE NULL END) AS 'Process'
,COUNT(CASE WHEN LoanState='Approve' THEN LoanState ELSE NULL END) AS 'Approve'
FROM yourloanTables
GROUP BY LoanOfficer


3/1/2007 10:13:33 PM

Thank You !!!

 That worked perfectly!!

3/1/2007 10:29:03 PM
You are welcome.

3/1/2007 10:29:58 PM

Similar Artilces:

Displaying a single Data Window Column in multiple columns
I have a datawindow that is retrieving a single column. Using Powerbuilder 5.04, is there anyway to display this data in multiple columns sorted (alphabeticlly) vertically (eliminates n-up). Any help would be appreciated. Thanks Yehuda Newspaper columns? Yehuda wrote in message <3ACB5511.E9262E3C@yahoo.com>... >I have a datawindow that is retrieving a single column. Using >Powerbuilder 5.04, is there anyway to display this data in multiple >columns sorted (alphabeticlly) vertically (eliminates n-up). Any help >would be appreciated. >Thanks >Yehuda &...

Displaying single column of data across multiple columns..
Hi all... Okies my problem.... I have a dataset that has a single column, with 100 rows. I wan't to display this in a table with 4 columns with 25 rows in each column.. Does anyone know of a simple solution? Thank's in advance. Jeremy Baka Saru Hi, you can try the DataList with RepeatColumns property set to 4.  Alvin ChooiMicrosoft ASP.NET™ Enthusiast v1.1 / v2.0, Malaysia Blog : http://alvinzc.blogspot.com...

Display multiple columns in Gridview from One Column of SQL table
Hi I have a table in sql with 2 columns and I want to display that in multiple columns in Gridview. SQL Table No.            Type 1               A1 1               B2 2              A2 2               B2 3        &...

How to manipulate images and combe multiple database columns into one column in a GridView control
Hi Folks,I'm hoping someone can help me out with something.I am trying to put together a photo album as a learning exercise and have a GridView control with two columns linked to an Access Data Source. In the left hand column (called Image) I want to display the photo and in the right hand column (called Details) I want to provide details such as Date, Location, People and Comments, Camera Type etc. Each of these is columns is taken from the database I have set up.However, I have am having some problems:1: At the moment I have been able to get the image to display (using an image column ...

Display Multiple Columns into One Column
My first ASP.NET/SQL project. I'm creating an Asset Management DB. I wish to view the Asset number, the full name of the user it's assigned to and the Make and Model of each record in the DB. However assets are split into different categories e.g. monitors, PCs, Preinters etc. and they are all in different tables. The SQL below displays the asset number, Name of person assigned and the model of the asset. SELECT Hardware.AssetNo, [User].FullName, MonitorModel.Model, PCModel.Model AS Expr1, PrinterModel.Model AS Expr2 FROM Hardware INNER JOIN [User] ON Hardware.UserID = [User].User...

split single column into multiple column
 Hi all,I have table with 2 columns as shown below...id     products_list  1    a,b,c2     d,e,f3     g,h,iNow I need a query which will ouput the result as below...id     products_list1    products_list2       products_list3  1    a                      b                    &...

Sorting columns when displaying single column in DataList
Currently, I am using the DataList to display the data. My DataList code looks something like this:<datalist><itemTemplate><tr><td>Name:</td><td><% DataBinder.....%></td></tr><tr><td>Company:</td><td><% DataBinder.....%></td></tr></itemTemplate></datalist>  My question is: How can I have an easy way of sorting this data. I would like the users to be able to sort the data by Name or by Company. I understand I can add AllowSorting to DataList or DataGrid, but then I would have to di...

Create multiple datagrid columns from single column
I have a datagrid that generates a single column of data that is extremely long. I'd like to find a method to create multiple columns from the single column so the data is easier to read. I have tried the DIV method to create a scroll bar, but it's still a single column of data. The other goal is to make the data printable. If I can crop the column when it hits the bottom of the page, and then start it again on a new column it will be easier to read and printable. Is this possible? Should I be using a different control other than a datagrid? Thanks!------------------------------...

Using the gridview to display multiple joined tables, and then allow editing of all columns displayed?
I'm just curious if this is possible. I'm using a SqlDataSource to populate a gridview with data from multiple tables using a inner join select statement.It would be nice if it were possible to allow a user to click "Edit" and be able to update every single column for the particular row in every single table. Is it possible to do something like this?   Yes this is possible, you just have to use the proper Edit SQL command, that might be a little complex depending on how many DataTables you are editing.www.someguy.ca rantings from some Canadian guyFollow me on twitter as...

Display Multiple Datasets in a Single GridView or Use a Timer Control to Display Multple Results
I am trying to get the gridview to display the results of multiple dataset that containg SQL Queries. I have a combobox that allows the user to select a Query to run and then it returns the results to the datagrid, however I can not get it to display multiple results in the same gridview. The following works now to display one along with else if but I need to display all selected at the sametime. I have been advise that this may not be possible, and if it's not can someone direct me on using a Timer Control to display multiple DataSet results in various intervals on the same DataGrid. ...

GridView lookup column
I have a database with the following structure: Events (ID, Date, Description); People (Name ...); and Attendance (ID, Event, Name). I want to (for a given person) list all the events that that person attended in a GridView. I have this working, except that instead of listing the date of the event in the table, it lists the ID, which is meaningless. Is there a way I could display in two columns the event date and description rather than the ID for each event that that person attended? I want to leave ID the primary key to allow for multiple events on the same date.1 <asp:GridView ID=...

Display only Columns that have Data in GridView Control
Good evening to the community, thanks for the help that ever provideThe situation is the following:I'm working in a application that have like 50 columns in the Database that represents Earning Codes for employees, but most of the times only 10 are used.What if something can be done to only display in the GridView Control the columns that the value is different than Null. Thanks for any lead evick   If you set the gridview to auto create the columns based on the datasource then when selecting data from the db only return the columns that have data in them. aspro Please m...

bulletedlist control
Hi, I understand that the Bulletedlist control populates data from a single column of a database table.Is it possible to populate the control from multiple columns? Please advise. Thanks.  can you explain in details what you wanna do ? I would like to populate the bulletedlist with data from multiple columns of a database table. Is this possible?Example: table1col1      col2      col3------      ------      ------apple    boy      ...

How do I populate a formview from multiple columns in a gridview
Hi, I have a master/detail scenario whereby to populate a formview, the user selects a row in the gridview.  The SqlDataSource used to populate the formview needs to check 2 columns from the gridview, ZRef (which is the SelectedValue of the Gridview) and ZName (a string). From searching the forums it looks like I have to programmatically assign the SelectParameters in order to get ZName from the gridview.  Seems fair enough, so I set the parameters in the 'Selecting' event of the SqlDataSource.  (Code shown below).  However the formview never shows.  In debug I ca...

Web resources about - displaying multiple columns in a gridview populated from a single column - asp.net.presentation-controls

List of birds displaying homosexual behavior - Wikipedia, the free encyclopedia
This list includes birds for which there is documented evidence of homosexual or transgender behavior of one or more of the following kinds: ...

Facebook Displaying Page Insights On Page Admins’ Personal Pages?
Some Facebook page administrators are seeing modules on their personal pages displaying page insights ad, campaign , and like totals for pages ...

Facebook Displaying Unread Messages from Pages in a New Updates Module
Facebook is displaying a new “Updates” sidebar module which shows some users unread messages sent to them by Pages. Users will see the Updates ...

Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air CNN Live - YouTube
Don Lemon Holds Up Sign Displaying the N-Word, Uncensored, on Air Lemon held up a Confederate flag first before holding up the sign. He asked, ...

Hazelwood coal mine fire: Morwell residents displaying symptoms similar to cigarette smokers, expert ...
An expert says some locals near Victoria's Hazelwood mine fire have symptoms similar to cigarette smokers.

Police accused of displaying fake G20 weapons
Toronto's top police officer misled the public by displaying fake weapons used in a medieval-themed role-playing game to help justify their actions ...

Displaying calorie labels at fast-food restaurants doesn't appear to work: study
While the high calorie counts of artery-clogging fast foods are often printed right in front of our eyes, most people ignore them and go ahead ...

Jays' Escobar suspended three games for displaying slur
Toronto Blue Jays shortstop Yunel Escobar has been suspended three games for displaying a homophobic slur on his eye-black during a game on Saturday. ...

Google Play Store now displaying age-based ratings
We reported back in May that Google was adding age-based ratings to all apps in the Play Store as determined by the International Age Rating ...

Google begins displaying “Listen Now” ads for streaming music services (including Beats) in search results ...
... , Streaming Music Continue reading more about Apps , Google , and Spotify at 9to5Mac . What do you think? Discuss "Google begins displaying ...

Resources last updated: 12/30/2015 5:11:20 PM