Use MVCContrib grid for editing?

It appears as if MVCContrib is a simple way to construct the HTML Table from a collection of model objects. It doesn't appear as if has any ability to put a row into edit/update/delete "mode" similar to the WebForms GridView However, it does look like you can handle that functionality however you want to. If you want to go to a separate page for edit mode, just put a link in one of the columns with that row's id.

The following is taken directly from: jeremyskinner.co.uk/2009/03/01/mvccontri... % Html. Grid(Model). Columns(column => { column.

For(x => x. Id). Named("Person ID"); column.

For(x => x. Name); column. For(x => x.

Gender); column. For(x => x. DateOfBirth); column.

For("View Person"). Named(""). Action(p => { %> { if (row.

IsAlternate) { %.

It appears as if MVCContrib is a simple way to construct the HTML Table from a collection of model objects. It doesn't appear as if has any ability to put a row into edit/update/delete "mode" similar to the WebForms GridView. However, it does look like you can handle that functionality however you want to.

If you want to go to a separate page for edit mode, just put a link in one of the columns with that row's id. The following is taken directly from: jeremyskinner.co.uk/2009/03/01/mvccontri... { column. For(x => x.Id).

Named("Person ID"); column. For(x => x.Name); column. For(x => x.

Gender); column. For(x => x. DateOfBirth); column.

For("View Person"). Named(""). Action(p => { %> { if (row.

IsAlternate) { %> Here it looks like they are wanting to direct the user to a View Person page: . Good luck, and happy coding.

You can add edit mode rendering by customizing the way a cell is rendered. I'm using the following extension method: public static IGridColumn Action( this IGridColumn column, Func viewAction, Func editAction, Func editMode ) { column. CustomItemRenderer = ( context, item ) => context.Writer.

Write( "" + ( editMode( item )? EditAction( item ) : viewAction( item ) ) + "" ); return column; } This allows you to specify how the column is rendered in view-mode and in edit-mode. The mode is determined using a third action that should evaluate to true for the row you want to edit.

Using this in a view would look something like this: { column. For( x => x. Name ).

Action( item => Html. ActionLink( item. Name, "SomeAction" ), item => Html.

TextBox( "Item. Name", item. Name ), item => ( Model.

SelectedItem == item ) ); } ) . Empty("No items found. ") %> You can use the same pattern to render action links (edit, apply, cancel etc.) in a cell.

If you want to edit multiple rows at once, make sure the field names are unique.

– remo Apr 4 at 16:42 1 @sharma Extension methods have to be within a reachable namespace, so within a view (.aspx/. Ascx) make sure you Import the namespace with the static class that has your extension method. – Marnix van Valen Apr 4 at 17:39 Thank you, It worked well.

It indeed moved to a different page, and I did not have textbox appearing to edit it, any directions on how to display edittable textbox and grabbing info from there? – remo Apr 4 at 20:36 @sharma I'm not sure I understand your question. Maybe you should post a new question here on StackOverflow, explain what exactly you want to accomplish and add the code you have now.

You'll get much better feedback that way. – Marnix van Valen Apr 5 at 8:16 Can you look at it: stackoverflow.Com/questions/5544217/… – remo Apr 5 at 12:31.

Can you have this example in VB, instead of C# { column. For(x => x. Id).

Named("Person ID"); column. For(x => x. Name); column.

For(x => x. Gender); column. For(x => x.

DateOfBirth); column. For("View Person"). Named("").

Action(p => { %> { if (row. IsAlternate) { %.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions