I am playing with MVC 4 in VS 2012 with a local DB using Entity Framework.
On one of my edit pages for customer details I have a drop down box that displays the customer's surname. The razor code for this is
<div class="editor-label">
@Html.LabelFor(model => model.CustomerID, "Customer")
</div>
<div class="editor-field">
@Html.DropDownList("CustomerID", String.Empty)
@Html.ValidationMessageFor(model => model.CustomerID)
</div>
My customer DB table has the following setup.
[CustomerID] INT IDENTITY (1, 1) NOT NULL,
[LastName] NVARCHAR (MAX) NULL,
[FirstMidName] NVARCHAR (MAX) NULL,
[JoinDate] DATETIME NOT NULL,
[Email] NVARCHAR (MAX) NULL,
[Address] NVARCHAR (MAX) NULL,
CONSTRAINT [PK_dbo.Customer] PRIMARY KEY CLUSTERED ([CustomerID] ASC));
How do I combine both firstmidname and last name in the drop down?
T.Rahgooyanswer you can tryKonrad Gadzinaanswer here - stackoverflow.com/questions/16099258/…. Pretty sure that if you concatenate the three strings it will work.