Solved

DevExpress Datasource and ASP .Net MVC

Posted on 2011-02-24
1
1,740 Views
Last Modified: 2012-05-11
How to integrate DevExpress into the MVC code below since I don't have a datasource but a model instead?

<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxRoundPanel" TagPrefix="dxrp" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxMenu" TagPrefix="dxm" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxSiteMapControl" TagPrefix="dxsm" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxNavBar" TagPrefix="dxnb" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxTabControl" TagPrefix="dxtc" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxClasses" tagprefix="dxw" %>
<%@ Register assembly="DevExpress.Web.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxHeadline" TagPrefix="dxhl" %>
<%@ Register Assembly="DevExpress.Web.ASPxEditors.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxEditors" TagPrefix="dxe" %>

<%@ Register Assembly="DevExpress.Web.ASPxGridView.v9.2, Version=9.2.6.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" Namespace="DevExpress.Web.ASPxGridView" TagPrefix="dxwgv" %>

<%@ Page Title="" Language="C#" MasterPageFile="Demo.master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<MvcApplication1.Models.Project>>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="phContent" runat="server">

       <dxwgv:ASPxGridView ID="grid" DataSourceID???? ClientInstanceName="grid" runat="server" KeyFieldName="SupplierID" Width="100%">
            <%-- BeginRegion Grid Columns --%>
            <Columns>
                <dxwgv:GridViewDataColumn FieldName="ContactName" VisibleIndex="1">
                </dxwgv:GridViewDataColumn>
                <dxwgv:GridViewDataColumn FieldName="CompanyName" VisibleIndex="2">
                </dxwgv:GridViewDataColumn>
                <dxwgv:GridViewDataColumn FieldName="City" VisibleIndex="2">
                </dxwgv:GridViewDataColumn>
                <dxwgv:GridViewDataColumn FieldName="Region" Visible="false">
                </dxwgv:GridViewDataColumn>
                <dxwgv:GridViewDataColumn FieldName="Country" VisibleIndex="3">
                </dxwgv:GridViewDataColumn>
            </Columns>
         </dxwgv:ASPxGridView>
    <h2>Index</h2>

    <table>
        <tr>
            <th></th>
            <th>
                ProjectID
            </th>
            <th>
                ProjectNumber
            </th>
            <th>
                ProjectTitle
            </th>
            <th>
                StartDate
            </th>
            <th>
                EndDate
            </th>
            <th>
                MinLatitude
            </th>
            <th>
                MaxLatitude
            </th>
            <th>
                MinLongitude
            </th>
            <th>
                MaxLongitude
            </th>
            <th>
                MinAltitude
            </th>
            <th>
                MaxAltitude
            </th>
            <th>
                ObjectiveCode
            </th>
            <th>
                TracerID
            </th>
            <th>
                TracerInfo
            </th>
            <th>
                AnalyticalErrors
            </th>
            <th>
                ProjectReferences
            </th>
            <th>
                SummaryInfo
            </th>
            <th>
                TCProjectNumber
            </th>
            <th>
                DistributionRestricted
            </th>
            <th>
                CheckStatus
            </th>
            <th>
                Complete
            </th>
            <th>
                DateEntered
            </th>
            <th>
                DateChanged
            </th>
            <th>
                DateExported
            </th>
        </tr>

    <% foreach (var item in Model) { %>
    
        <tr>
            <td>
                <%: Html.ActionLink("Edit", "Edit", new { id=item.ProjectID }) %> |
                <%: Html.ActionLink("Details", "Details", new { id=item.ProjectID })%> |
                <%: Html.ActionLink("Delete", "Delete", new { id=item.ProjectID })%>
            </td>
            <td>
                <%: item.ProjectID %>
            </td>
            <td>
                <%: item.ProjectNumber %>
            </td>
            <td>
                <%: item.ProjectTitle %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.StartDate) %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.EndDate) %>
            </td>
            <td>
                <%: item.MinLatitude %>
            </td>
            <td>
                <%: item.MaxLatitude %>
            </td>
            <td>
                <%: item.MinLongitude %>
            </td>
            <td>
                <%: item.MaxLongitude %>
            </td>
            <td>
                <%: item.MinAltitude %>
            </td>
            <td>
                <%: item.MaxAltitude %>
            </td>
            <td>
                <%: item.ObjectiveCode %>
            </td>
            <td>
                <%: item.TracerID %>
            </td>
            <td>
                <%: item.TracerInfo %>
            </td>
            <td>
                <%: item.AnalyticalErrors %>
            </td>
            <td>
                <%: item.ProjectReferences %>
            </td>
            <td>
                <%: item.SummaryInfo %>
            </td>
            <td>
                <%: item.TCProjectNumber %>
            </td>
            <td>
                <%: item.DistributionRestricted %>
            </td>
            <td>
                <%: item.CheckStatus %>
            </td>
            <td>
                <%: item.Complete %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.DateEntered) %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.DateChanged) %>
            </td>
            <td>
                <%: String.Format("{0:g}", item.DateExported) %>
            </td>
        </tr>
    
    <% } %>

    </table>

    <p>
        <%: Html.ActionLink("Create New", "Create") %>
    </p>

</asp:Content>

Open in new window

0
Comment
Question by:DistillingExperts
1 Comment
 
LVL 12

Accepted Solution

by:
Mamtha1982 earned 500 total points
ID: 34977036
You shuold not use ASP.NET controls in MVC application.

check the following link:
http://somewebguy.wordpress.com/2009/08/07/webcontrols-in-mvc-part-2/
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question