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?