Get Results from Grid in Post HttpVerb

Thread is closed for posting
2 posts, 1 answers
  1. Nick Devore
    Nick Devore avatar
    9 posts
    Member since:
    Mar 2006

    Posted 04 Mar 2009 Link to this post

    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:
    1 <% using (Html.BeginForm()) {%> 
    2     <div style="width: 100%;"
    3         <div style="float: left;"
    4             <input type="submit" value="Save Queue Changes" /></div
    5         <div style="float: right; text-align: right;"
    6             <%= String.Format("{0} Tickets in Queue", Model.Rows.Count) %></div
    7     </div> 
    8      
    9     <telerik:RadGrid ID="rgTickets" runat="server" AutoGenerateColumns="false" Style="clear: both;"
    10         <MasterTableView DataKeyNames="CallId" EditMode="InPlace"
    11             <Columns> 
    12                 <telerik:GridTemplateColumn> 
    13                     <HeaderStyle Width="50px" /> 
    14                     <ItemStyle Width="50px" /> 
    15                     <ItemTemplate> 
    16                         <%# Html.TextBox("Precedence", Eval("Precedence"), new { width = "25px" })%> 
    17                         <%# Html.ActionLink("Move To Top", "MoveToTop", new { ticketId = ((System.Data.DataRowView)Container.DataItem)["CallId"], queueId = ((QueueDefEntity)ViewData["QueueDef"]).QueueId })%> 
    18                         <br /> 
    19                         <%# Eval("InsertDate").ToString().Length > 0 ? string.Format("Prioritized by {0} <br />{1}",Eval("InsertUser"),Eval("InsertDate")) : "" %> 
    20                     </ItemTemplate> 
    21                 </telerik:GridTemplateColumn> 
    22                 <telerik:GridBoundColumn DataField="CallId" UniqueName="CallId" HeaderText="Ticket Number" /> 
    23                 <telerik:GridBoundColumn DataField="CallDesc" UniqueName="CallDesc" HeaderText="Problem Description" /> 
    24                 <telerik:GridBoundColumn DataField="ReceivedTimestamp" UniqueName="ReceivedTimestamp" 
    25                     HeaderText="Received" DataFormatString="{0:dd MMM yyyy h:mm tt}" /> 
    26             </Columns> 
    27         </MasterTableView> 
    28     </telerik:RadGrid> 
    29     <% } %> 

    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:

    1 <%@ 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?
  2. Answer
    Rosen
    Admin
    Rosen avatar
    3234 posts

    Posted 09 Mar 2009 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top