Solved

DevExpress Datasource and ASP .Net MVC

Posted on 2011-02-24
1
1,729 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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