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

[Solved] Change Grid datasource dynamically

0 Answers 126 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.
Chamara
Top achievements
Rank 1
Chamara asked on 25 May 2013, 01:29 PM
I need to change the telerik mvc grid datasource on a dropdown selection change. below is my current view and i want to change the grid with the dropdown selection.

<%@ Page Title="" Language="C#" MasterPageFile="~/ViewMasterPage.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<GateApplication.Models.Gate>>" %>
<%@ Import Namespace="Telerik.Web.Mvc.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Index
  
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

<div align="left" style="width: 100%">
<table><tr>
<td>Search Form: </td>
<td><%= Html.Telerik().DropDownListFor(model => ViewData["drpSearch"])
                         .HtmlAttributes(new { @Style="width:250px" })
                                         .BindTo(new SelectList((List<SelectListItem>)ViewData["drpSearch"], "Text", "Value"))%></td>
</tr></table>

</div>
                                         <br />
                                   
    <%= Html.Telerik().Grid(Model)
        .Name("Grid")
        .Columns(columns =>
        {
            columns.Bound(o => o.ID).Visible(false);
           columns.Bound(o => o.Urgency);
            columns.Bound(o => o.FullName);
            columns.Bound(o => o.Email);
            columns.Bound(o => o.GateSupportedBy);
            columns.Bound(o => o.FullPhone1).Title("Phone Number");
            columns.Bound(o => o.StNstNo).Title("St. and St. No.");
          
        })
     
        .DataBinding(dataBinding => 
        {

            dataBinding.Ajax().Select("AjaxGrid",
                "Gate").Enabled(true);
        })
                .Scrollable(scrolling => scrolling.Enabled(true))
                .Sortable(sorting => sorting.Enabled(true))
                .Pageable(paging => paging.Enabled(true).PageSize(10))
                .Filterable(filtering => filtering.Enabled(true))
                .Groupable(grouping => grouping.Enabled(true))
                .Footer(true)
%>
    
</asp:Content>
Tags
Grid
Asked by
Chamara
Top achievements
Rank 1
Share this question
or