.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Combine multiple columns in EF

Posted By:      Posted Date: September 29, 2010    Points: 0   Category :ASP.Net


I'm using VS2010, EF. My goal is to combine multiple columns in my metadata so I can display a complete address in one column from a gridview (list). 

Such as:

The Coffee House
100 Main Street
South Bend, IN 46556

Here's my code; (I also want to add line breaks)

    public partial class ResHistory
    public class ResHistoryMetaData
        [DisplayColumn("Address1", "Address1", false)]
        public partial class Address1
            public override string ToString()
                return Address1.ToString() + " " + Address2.ToString() + " " + City.ToString() + " " + State.ToString() + " " + Zip.ToString();


The error I'm getting:

Error 2 The name 'Address2' does not exist in the current context
Error 3 The name 'City' does not exist in the current context
Error 4 The name 'State' does not exist in the current context
Error 5 The name 'Zip' does not exist in the current context

View Complete Post

More Related Resource Links

Adding Multiple Columns and Rows in GridView without using a Database

This article describes on how to add multiple columns and rows in GridView without using a database. Basically the GridView will be populated with data based on the values entered in each TextBoxes on Button Click and retain the GridView data on post back.

Web Services: Increase Your App's Reach Using WSDL to Combine Multiple Web Services


The very tools that have helped drive the growing adoption of Web services, and the enabling abstractions that they provide, can often prevent developers from peeking behind the curtains at the XML standards that make up the Web services stack. This article will offer a solution that enables type sharing between proxies created for complementary Web services, while at the same time providing an opportunity to examine the Web Services Description Language (WSDL) and its interaction with the Web services tools you know and love.

Gerrard Lindsay

MSDN Magazine March 2005

Filter search over multiple text columns


Hi everyone,

I'm working on a library that stores information on various cases. The case table has several columns that contain descriptive strings on what happened in the case. I would like to create a single filter that returns all cases where the search string is found in any of the columns. I've looked at Dynamic Data Filtering, but as far as I can tell, the "Contains" filter only allows you to connect to each column individually. Has anyone tried this?



Autocomplete display multiple columns


 Hi --

I have an autocomplete extender working great returning one column and I can also retrieve multiple columns just fine from my stored procedure, but here's what I really need to do:

1. Format the data in the autocomplete extender in the following format:

Location Number
City, State, Zip

2. When the user makes a selection I want only the Location Number to populate the textbox.

I've looked quite a bit on this site and others on how to do #2 and I can't seem to find exactly how this should be done. Is there some javascript that needs to be involved in order accomplish this?

If anyone has done this I would really appreciate an example.




split a column into multiple columns

Hi i have a column with the following values from my source FILENAME ComplianceStatus_ER_06022010.xml ComplianceStatus_AZER_07052010.xml ComplianceStatus_GEL_06022010.xml ComplianceStatus_AFF_05022010.xml ComplianceStatus_Good_2010.xml   I want to split the date into different columns as follows using ssis   FILENAME                            CLIENT      DATE ComplianceStatus_ER_06022010.xml    ER          06022010 ComplianceStatus_AZER_07052010.xml  AZER        07052010 ComplianceStatus_GEL_06022010.xml   GEL         06022010 ComplianceStatus_AFF_05022010.xml   AFF         05022010 ComplianceStatus_Good_2010.xml      Good        2010  

Format with Multiple Columns

How do I acheive below format in reporting services? part  qty    part  qty     part  qty p1     10      p2   11     p3    14 p4     16      p5    12    p6     20 Thanks in advance.

How do I combine multiple VB arraylists into one?

 Hi Everyone- I have three arraylists (datasets and subsets) that I need to combine into one arrraylist so I can databind it to a repeater control and then present data to the user.  As far as I know, you can only bind the repeater with one datasource (please correct me if this is wrong) that's why I'm combining these arraylists. Each arraylist has an ID from the database which I can use as a datakey to keep the data aligned.  How do I combine these lists? Thanks for your help!


the database result is as follows DATE     code   class1 class2  class3 1/8/10     M1     10       20     30     3/8/10     V2      20       30     10      1/8/10      H1      1           2      3         7/8/10     ! ! 8/8/10     !M2    5      5      5       3/8/10     B2      4      4     4       1/8/10     V1      3      7     3       THE OUTPUT SHOULD BE AS FOLLOWS:- DATE           M1                          M2           

Display records in multiple columns in asp.net mvc

 Hello,i'm newbie to asp.net mvc. i use mvc 1.0 since my host supports that.i have a piece of code in my view like this and i want to change it in order to be able to show records in 4 columns.What should i do?<table>            <% foreach (var item in Model) { %>                     <tr>                                  <td>    <%=Html.ActionLink(item.CategoryName + "(" + item.NumberOfWebsitesInCategory + ")", "SubCategory", new { CatID = item.CategoryID }, new {style="text-decoration:none;" })%>                         </td>                    </tr>        <% } %>    </table>

InfoPath 2007 - Publishing Creates multiple columns on SharePoint Form Library (GUIDS apparently are

I have been working this issue for 2 days now.  This has happened to me in the past and I was able to work through it.  It doesn't appear that this time I am going to be so lucky. Issue Description: When publishing an InfoPath form a new column is created that has the same name as the correct one, but a new GUID is created. Troubleshooting steps: I have read this article: http://www.delphi-ts.com/blogs/lozzi/post/2009/06/03/Duplicate-site-columns-in-MOSS-from-InfoPath-Forms.aspx   This was the solution the last time I had this problem.  However, no matter what I do, it is not working now.  I have a column named User Name which is the username of the person that submitted the InfoPath form for use with my Visual Studio workflow.  When the workflow kicks off, it reads this column and attempts to get the value.  The value is blank because a new column with the name User Name now exists and that is where the value is stored.  I attempted to fix it by remapping the GUIDs as described in the article.  I also reverted the code to a previous version from TFS.  None of these worked.   I now have 3 columns called User Name and I can remap the GUID to the second column and third column.  But when I try to map it to the first column (the one I need) it doesn't work. The first column that is circled is the correct column. 

GridView split over multiple columns



I have a project where I need the one datagrid displaying all values on the one screen, thus I don't have paging enabled.

Is there a way to get a gridview to 'split' over two columns?

ie instead of having

|<- column 1 ->|<- column 2 ->|<-button->|

item 1


Item 30


|<- column 1 ->|<- column 2 ->|<-button->|<- column 1 ->|<- column 2 ->|<-button->|

Item 1                                                            Item 16


Item 15                                                          Item 30

Combine multiple xml elements into one column field based on subheading


I need to pull down data from a third party vendor's SQL view, where one of the columns is xml. I've never worked with xml before; unfortunately our vendor was not willing to change the format to what they were previously providing.

XML Example:

<ResponseDTO xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">

Sort WPF Datagrid using multiple columns



Is it possible to sort a WPF datagrid using more than one column ?



It is possible to alter multiple columns within a single alter table statement?


It is possible to alter multiple columns within a single alter table statement?

I tried & searched not getting it.

Alter table au_de alter column m_user char(9),c_user char(9)

Msg 102, Level 15, State 1, Line 1

Incorrect syntax near ','.


Alter table au_de alter column m_user char(9),alter column c_user char(9)
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near ','.

How to combine two columns in the GridView?


Hi all,

If I have two two columns: Date1 and date2,
I would like to display in GridView1 than one column.

Date1 = 10/06/2010
Date2 = 07.10.2010

GridView1 (date1 + date2) = 06.10.2010 - 07.10.2010



Distinct List View over multiple columns


I have a custom list with People, Courses, and Completion Dates. People take multiple courses, and sometimes they also take a course again to refresh. I would like to show the list with all people and all courses, but if a person has taken the same course multiple times, I only want to show the last time the course was taken. In SQL this would be some sort of a DISTINCT query over the combination of PERSON and COURSE. Has anyone done something like this with SP lists (without code ;-) ).

A workaround would be to flag expired courses, once the person has taken the course again. This way you could filter for the not-expired records, but maybe there is a better way. Suggestions?




Combine Column Group Columns Into One?


I have a dataset like this:



1........... 09-2010................25,000




I have a report that shows this data by pivoting on the month and giving the remaining amount, like this:

BID......Aug-2010 Remaining........Sep-2010 Remaining.......Oct-2010 Remaining........Nov-2010 Remaining



This all works just fine. However now, I want to take a date that's given, and make a "Past Due" column for anything less than the first of the month of that date.


I have this partially working, as I can filter my column group to be >= CDate(Month(Parameters!CurrentDate.Value) & "/01/" & Year(Parameters!CurrentDate.Value)).


This would give me this:

BID.......Oct-2010 Remaining........Nov-2010 Remaining

1.......... 25,000..............................100,000


How do I combine the previous months into one column? Like this:

BID......Past Due Remaining.......Oct-2010 Remaining........Nov-2

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend