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

Get Results from Grid in Post HttpVerb

1 Answer 111 Views
UI for ASP.NET AJAX in ASP.NET MVC
This is a migrated thread and some comments may be shown as answers.
Nick Devore
Top achievements
Rank 2
Nick Devore asked on 04 Mar 2009, 07:25 PM
I'm enhancing our ticket tracking system to allow users to organize the priority of their tickets similar to a Netflix queue.  I'm using the RadGrid to display all the tickets with an "Precedent Number" column that is a HtmlHelper.TextBox inside of an ItemTemplate column.

The view code looks like this:
<% using (Html.BeginForm()) {%> 
    <div style="width: 100%;"
        <div style="float: left;"
            <input type="submit" value="Save Queue Changes" /></div
        <div style="float: right; text-align: right;"
            <%= String.Format("{0} Tickets in Queue", Model.Rows.Count) %></div
    </div> 
     
    <telerik:RadGrid ID="rgTickets" runat="server" AutoGenerateColumns="false" Style="clear: both;"
        <MasterTableView DataKeyNames="CallId" EditMode="InPlace"
            <Columns> 
                <telerik:GridTemplateColumn> 
                    <HeaderStyle Width="50px" /> 
                    <ItemStyle Width="50px" /> 
                    <ItemTemplate> 
                        <%# Html.TextBox("Precedence", Eval("Precedence"), new { width = "25px" })%> 
                        <%# Html.ActionLink("Move To Top", "MoveToTop", new { ticketId = ((System.Data.DataRowView)Container.DataItem)["CallId"], queueId = ((QueueDefEntity)ViewData["QueueDef"]).QueueId })%> 
                        <br /> 
                        <%# Eval("InsertDate").ToString().Length > 0 ? string.Format("Prioritized by {0} <br />{1}",Eval("InsertUser"),Eval("InsertDate")) : "" %> 
                    </ItemTemplate> 
                </telerik:GridTemplateColumn> 
                <telerik:GridBoundColumn DataField="CallId" UniqueName="CallId" HeaderText="Ticket Number" /> 
                <telerik:GridBoundColumn DataField="CallDesc" UniqueName="CallDesc" HeaderText="Problem Description" /> 
                <telerik:GridBoundColumn DataField="ReceivedTimestamp" UniqueName="ReceivedTimestamp" 
                    HeaderText="Received" DataFormatString="{0:dd MMM yyyy h:mm tt}" /> 
            </Columns> 
        </MasterTableView> 
    </telerik:RadGrid> 
    <% } %> 

When the user clicks the "Save Queue Changes" submit button, how do I get at the values inside of each text box?  My view is typed as such:

<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<System.Data.DataTable>" %> 

...what should I be expecting in my controller action method as a return value to enumerate through all the rows in the grid?

1 Answer, 1 is accepted

Sort by
0
Accepted
Rosen
Telerik team
answered on 09 Mar 2009, 08:09 AM
Hello Nick,

You may retrieve the values from the posted fields inside the Controller using a Request's Form object.
Please refer to this blog post for an example of how to update data using RadGrid control in a MVC environment.

Best wishes,
Rosen
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
UI for ASP.NET AJAX in ASP.NET MVC
Asked by
Nick Devore
Top achievements
Rank 2
Answers by
Rosen
Telerik team
Share this question
or