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.
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Grid Add with Column Template

Thread ID:

Created:

Updated:

Platform:

Replies:

118715 Apr 2,2015 01:46 PM UTC Apr 8,2015 12:20 PM UTC ASP.NET MVC 4
loading
Tags: Grid
Torbian Linz
Asked On April 2, 2015 01:46 PM UTC

Hi,

I put together multiple features from examples and now it's chaos.

I use a Grid with a Picture column (where a picture is just shown).

Now the user should be able to add a row (without adding a picture, this will happen later).

The Grid is in Batch editing mode. For the addition of a row I need a number of Features:

1. Allow Editing only certain Columns of the added row? Is that possible?

I found the Default Value of the columns and that lead me to the next problem:

2. When I add a row to the aforementioned grid, the columns are put in the wrong way. They are all pushed one position to the right.

I added a quick example to show what i mean.

Kind Regards,
Torbian Linz


Attachment: MvcApplication3_f43d346f.zip

Sellappandi Ramu [Syncfusion]
Replied On April 3, 2015 09:31 AM UTC

Hi Torbian,

Thanks for using Syncfusion products.

Query #1: Allow Editing only certain Columns of the added row? Is that possible?

Yes, we have a default property AllowEditing to set true or false to enable or disable the editing support in the particular column. Please refer the following code snippet.

col.Field("Verified").HeaderText("Verified").EditType(EditingType.Boolean).AllowEditing(false).DefaultValue(true).Width(100).Add();

Note: AllowEditing will set as false automatically to the template column.

Query#2: When I add a row to the aforementioned grid, the columns are put in the wrong way. They are all pushed one position to the right.

For your kind information, we need to set IsPrimaryKey for identity column to avoid this issue.

Based on your requirement we have created a sample and same can be downloaded from following location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/118715/ColumnTemplate-22289611.zip

Please let us know if you need any concerns.

Regards,

Sellappandi R


Torbian Linz
Replied On April 7, 2015 07:14 AM UTC

Hi,

For Query 2: In your example it looks correct, because you moved the tested columns before the picture. After the picture, the columns are still wrong. And no, for me it's not an option to put the picture into the last column.

Torbian Linz
Replied On April 7, 2015 07:30 AM UTC

Additionally, If I set AllowEditing in the Customer ID column, it is still editable after I add a row.

Sellappandi Ramu [Syncfusion]
Replied On April 8, 2015 12:20 PM UTC

Hi Torbian,

Thanks for the update. Please find the response below.

Query #1: If I set AllowEditing in the Customer ID column, it is still editable after I add a row.

Based on your requirement we have created a sample that can be downloaded from following link location.

Sample Link: http://www.syncfusion.com/downloads/support/forum/118715/ColumnTemplate2121238075.zip

In the provided sample we have used CellEdit event to ignore the edit operation in particular column while adding the new record. Please refer the following code snippet.

.Columns(col =>

{

col.HeaderText("Picture").Template(true).TemplateID("#photoTemplate").TextAlign(TextAlign.Right).Width(120).Add();

col.Field("CustomerID").HeaderText("Customer ID").Width(80).DefaultValue("This is Customer ID").Add();

}).ClientSideEvents(e=>e.CellEdit("cellEdit"))

)

<script>

function cellEdit(args) {

if (args.columnName == "CustomerID" && args.cell.parent().hasClass("e-insertedrow"))

args.cancel = true;

}

Query #2: In your example it looks correct, because you moved the tested columns before the picture. After the picture, the columns are still wrong.

We were able to reproduce the problem and have logged defect report regarding this. A support incident to track the status of this defect has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Regards,Sellappandi R


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

;