This is a migrated thread and some comments may be shown as answers.

[Solved] Grid Editing - generated column

1 Answer 117 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Bob
Top achievements
Rank 1
Bob asked on 02 Mar 2011, 07:20 PM
I am creating a grid for users to edit. The grid contains a column that is an ActionLink that provides some functionality related to the row of the column. Before I made the grid editable (with Ajax binding instead of Server), the ActionLink worked as expected. When I made the grid editable, the column no longer even displays in the grid! I need it to display, and I need to tell the editor how to create the column for new inserts, and I need it to be readonly for selected rows being edited. My grid:

(format code block does not seem to be working)

<%

Html.Telerik().Grid<L5Lobbying.Models.

 

l5activity

>(Model.activities)

 

 

 

.Name(

 

"grid2"

)

 

 

 

.ToolBar(toolbar => toolbar.Template(() =>
{ %>

 

 

<button id="activitybutton" class="toolbarbutton">Add a new Activity</button>

 

 

 

 

<% }))

.DataKeys(keys => keys.Add(c => c.l5activity_id))

.DataBinding(databinding => databinding

    .Ajax()

        .Select(

 

"ajax_SelectActivity", "L5Lobbying"

)

 

 

 

        .Insert("ajax_InsertActivity", "L5Lobbying" 

        .Update(

 

"ajax_UpdateActivity", "L5Lobbying"

 

 

        .Delete(

 

 

 

"ajax_DeleteActivity", "L5Lobbying"

))

 

 

 

.Columns(c => {

    c.Bound(o => o.date).Format(

 

"{0:d}").Title("DATE").Width(30); 

 

 

 

    c.Bound(o => o.bwac).Title(

 

 

 

"BWAC").Width(30); 

 

 

 

    c.Bound(o => o.bwacnum).Title(

 

 

 

"BWACNUM").Width(30); 

 

 

 

    c.Bound(o => o.supopp).Title(

 

 

 

"SUP/OPP").Width(30); 

 

 

 

    c.Bound(o => o.description).Title(

 

 

 

"DESCRIPTION").Width(300); 

 

 

 

    c.Command(commands => {

 

        commands.Edit();

 

        commands.Delete();

 

    }).Width(140).Title(

 

 

 

"COMMANDS"); 

 

 

 

    c.Bound(o => o.l5activity_id).Title(

 

 

 

"LOBBYISTS").Width(90).Format(Html.ActionLink(
        
"Add Lobbyists to Activity", "ManageLobActs", "L5Lobbying"new { activity_id = "{0}" },
            
null).ToString()).Encoded(false).Groupable(false).Filterable(false).Sortable(false

);

 

 

 

 })

.Pageable(p => p.PageSize(10)
                .Style(

 

GridPagerStyles.NextPreviousAndNumeric) 

 

 

 

                .Position(

 

 

 

GridPagerPosition

.Bottom))

 

 

 

                .Editable(editing => editing.Mode(GridEditMode.PopUp))

.Sortable()

.Filterable()

.Render();

%>

 


Any help would be greatly appreciated.
Thanks,
Bob

1 Answer, 1 is accepted

Sort by
0
Bob
Top achievements
Rank 1
answered on 04 Mar 2011, 08:16 PM
For those of you who had the same problem, I discovered that [Scaffolding(false)] caused the column to disappear from the Grid.
Bob
Tags
Grid
Asked by
Bob
Top achievements
Rank 1
Answers by
Bob
Top achievements
Rank 1
Share this question
or