Solved

DevExpress Datasource and ASP .Net MVC

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

744 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now