Welcome Guest Search | Active Topics | Sign In | Register

on grid, how do you exclude certain columns from entry? Options
Steve
Posted: Thursday, December 2, 2010 3:34:52 PM
Rank: Member
Groups: Member

Joined: 12/2/2010
Posts: 10
Hi, I am trying to work with adding a new item when the grid is set AllowNewItem=true.
I need two of the columns currently displayed to be excluded from the user being able to enter values into them. I need these columns to be editable after the row is added but I want to control the values entered

columns on grid
ID (RowNumberColumn)
FormName (TextBoxColumn)
Changed By User (StaticColumn)
Changed By Date (DateTimeColumn)

What I would like to have:

columns available on add new item line.
formName (TextBoxColumn)

I searched on the forum and looked at available properties but nothing jumped out at me either there on in the examples.
eo_support
Posted: Thursday, December 2, 2010 3:56:30 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

You won't be able to have different column types on different rows. What you can do is to handle the column's ClientSideBeginEdit on your column (the property takes a JavaScript function name) and then return false from your handler to prevent the cell from entering edit mode.

Thanks!
Steve
Posted: Friday, December 3, 2010 8:29:45 AM
Rank: Member
Groups: Member

Joined: 12/2/2010
Posts: 10
Thanks for the quick reply.

Just so I understand, what you are saying is that if you use the default AllowNewItem with the add row at the bottom, you cannot make one of those columns read-only if the column in the rest of the grid is editable ?
With the ClientSideBeginEdit, how to determine that the column is coming from the NewItem row and not from a row already added into the grid where I want to allow the column to be edited ?

If this isn't an option, can you use an ItemTemplate to build an add form below the grid and fire the OnItemAdded to the grid ?
eo_support
Posted: Friday, December 3, 2010 9:00:51 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Whatever you set on the column applies to the whole column. There is no additional settings for a column that would apply differently on different row. So AllowNewItem is irrelavent in this logic.

The GridCell object is passed to your ClientSideBeginEdit handler. You can get the GridItem object from the cell object, then get the item index from the GridItem object. You can then compare the item index against your original item count to see whether this is a new item or not.

It is also OK if you wish to build an add form below the Grid. However that template would not have anything to do with the Grid. It is possible for you to call Grid's client side addItem to add new item to the Grid thus fires OnItemAdded event, but you will have to write the code to wire these two pieces together. Otherwise the Grid is the Grid and your ItemTemplate is your ItemTemplate and they would not have anything to do with each other.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.