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

[Solved] Making HTTP POST inside a cell in the Grid

1 Answer 91 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.
Alaa Masoud
Top achievements
Rank 1
Alaa Masoud asked on 02 Mar 2011, 01:42 PM
Hello everyone!

I have a boolean column in my Grid. What I want to do is have a command that toggles the value of this column and causes a post back to persist the changes. What I would normally do without Telerik Grid would be something like this:

<table>
  <tr>
    ...
    <th>
      Approved
    </th>
  </tr>
@foreach (var item in Model) {
  <tr>
    ...
    <td>
      @if (item.Approved) {
        using (Html.BeginForm("Disapprove", "MyController", new { id = item.Id })) {
          @Html.AntiForgeryToken();
          <input type="submit" value="Disapprove" />
        }
      } else {
        using (Html.BeginForm("Approve", "MyController", new { id = item.Id })) {
          @Html.AntiForgeryToken();
          <input type="submit" value="Approve" />
        }
      }
    <td>
  </tr>
}
</table>

So basically when the page is rendered, if the value of Approved column in the current entity is true, the button would read 'Disapprove' and clicking that would post back to the Disapprove action and do changes in the database. The other way around works in a similar way.

My question is how can I implement a similar functionality using Telerik Grid ?

Any help would be appreciated.

1 Answer, 1 is accepted

Sort by
0
Alaa Masoud
Top achievements
Rank 1
answered on 02 Mar 2011, 03:44 PM
I solved this with jQuery
Tags
Grid
Asked by
Alaa Masoud
Top achievements
Rank 1
Answers by
Alaa Masoud
Top achievements
Rank 1
Share this question
or