We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Add a column with the Add(string mappingName) method

Thread ID:

Created:

Updated:

Platform:

Replies:

101919 Dec 5,2011 08:31 AM UTC Dec 5,2011 01:04 PM UTC ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
SebFrance
Asked On December 5, 2011 08:31 AM UTC

Hi all,

I have a MVC typed grid, but I don't know the type (it looks like Html.Syncfusion.Grid where T:class).

So I can't use lambda expression to add columns, I"m looking on the Add(string mappingName) method.

For example, if I have a grid of customers which contains a name property, I would like add the column like this:

column => column.Add("Name"). I can't do column=>column.Add(c=>c.Name), because I don't know the type of my datas, and I don't have to know it.

But it doesn't work ! I have empty cells...

Thanks for your help.



Eswari S [Syncfusion]
Replied On December 5, 2011 01:04 PM UTC

Hi SebFrance,

Thank you for using Syncfusion products.

Query #1 : , I"m looking on the Add(string mappingName) method

Your requirement can be achieved by specifying the “MappingName” of the column. And also we need to set the Unbound as false for those columns.

<%=Html.Syncfusion().Grid("OrdersGrid")
. . . . .
. . . .
.Column(col =>
{
//set UnBound as false , otherwise columns will be treated as unbound column and it will empty without any data's

col.Add("OrderID").UnBound(false);
col.Add("CustomerID").UnBound(false);
col.Add("EmployeeID").UnBound(false);
col.Add("ShipCity").UnBound(false);
col.Add("Freight").UnBound(false);
col.Add("ShipCountry").UnBound(false);
})


%>


For your convenience , we have prepared the sample and the same can be downloaded from the following link :

http://www.syncfusion.com/downloads/Support/DirectTrac/87446/Sample-346942925.zip


Note: If you want to run the sample in MVC3, change the configuration manager as Debug_MVC3/Release_MVC3.To briefly know about that steps please kindly refer this document link.

How to Switch between MVC2 to MVC3

Please try this and let us know if you need any further assistance.

Regards,
Eswari.S




CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

;