Skip to main content
A newer version of this page is available. .

Common Server-Side Issues

  • 10 minutes to read

The links below describe how to solve common server-side issues:

“The controller for ASPxUploadProgressHandlerPage.ashx was not found or does not implement IController”

“Internal Error. Unable to find the X resource in the Y”

“A primary key field specified using the KeyFieldName property is not found”

The “Key expression is undefined” error occurs when you use GridViewExtension.BindToLINQ / GridViewExtension.BindToEF methods

“The X has no access to path Y” or “Access to the path X is denied” (Image and File Extensions)

Why redirect to another page or View does not work on AJAX requests

“Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported”

An alert message with the HTML/JavaScript/CSS content appears when you use callback-aware extensions

“An extension with ‘X’ name is already rendered”

‘System.Web.WebPages.Html.HtmlHelper’ does not contain a definition for ‘DevExpress’

“The controller for ASPxUploadProgressHandlerPage.ashx was not found or does not implement IController”

Error Description:

This error can occur when you upload a file (in advanced upload mode) for the following extensions that use the ASPxUploadProgressHttpHandler:

Solution:

Try one of the following suggestions to overcome this issue:

“Internal Error. Unable to find the X resource in the Y”

Error Description:

The “Internal error. Unable to find the X resource in the Y” error can occur when you send a request to a page that contains DevExpress ASP.NET MVC extensions.

Solution:

  1. Upgrade the DevExpress assemblies as described in the The “Type ‘X’ exists in both assemblies” or “‘X’ is ambiguous in namespace ‘Y’” errors occur topic.

  2. Restart the IIS Web Server (the “iisreset” Windows command).

  3. Remove the “App_Licenses.dll” and “licenses.licx” files: How to remove the “This is a trial version” splash window.

  4. For IIS v7, use “Classic Pipeline mode” instead of “Integrated”;

  5. Modify an application’s web.config file after deploying and insert a space character to force the IIS Web Server to restart the application.

  6. Register the ASPxHttpHandlerModule in the web.config file as described in the following help topic: How to: Register the ASPxHttpHandlerModule.

For Windows Server 2008 OS:

  • Make sure that all necessary DevExpress assemblies are deployed in a Web application’s Bin folder if a DevExpress product is not installed on the target server.
  • Run the application.
  • Refer to any page with DevExpress ASP.NET MVC extensions.
  • Restart the IIS Web Server (the “iisreset” Windows command).
  • Reload the page.

“A primary key field specified using the KeyFieldName property is not found”

Error Description:

The error can occur when you use the following extensions:

Solution:

Check whether the KeyFieldName property is specified if you use the following GridView features:

  • Editing.
  • Selection.
  • Master Detail.
  • Endless Paging.

Try one of the following suggestions to overcome this issue:

  1. A data source does not contain a field specified in the KeyFieldName property. Make sure the field name is spelled correctly and in the correct case.

  2. The field is not marked with the “public” keyword or does not have “get”/“set” accessors. You should implement the “get”/“set” accessors for the fields/properties you use;

  3. The data source fields were changed and do not contain this field. You should update the KeyFieldName property to reflect the changes made to the data source.

  4. The data source does not contain data records, and the GridView cannot map the schema of data records. Handle the GridViewSettings.DataBinding event and specify the data record type (MVCxGridView.ForceDataRowType).

    @Html.DevExpress().GridView(settings => {
        settings.DataBinding = (send, evargs) => {
            MVCxGridView grid = send as MVCxGridView;
            grid.ForceDataRowType(typeof(DATA_RECORD_TYPE_HERE));
        };
    }).BindToEF()
    
  5. The GridView extension is incorrectly bound to its data source. See also: Why might paging (sorting, grouping, filtering) not work in the ASPxGridView.

  6. Set the EnableRowsCache property to false.

The “Key expression is undefined” error occurs when you use GridViewExtension.BindToLINQ / GridViewExtension.BindToEF methods

Error Description:

This error can occur when the GridViewExtension.BindToLINQ and GridViewExtension.BindToEF methods cannot automatically recognize the key (unique) column from the TableName or QueryableSource specified at runtime.

Solution:

Do the following to resolve this issue:

  • Use the GridViewExtension.BindToLINQ/GridViewExtension.BindToEF methods (MVC).

  • Specify the e.KeyExpression property.

@Html.DevExpress().GridView(  
    settings => {  
    ...  
}).BindToLINQ(string.Empty, string.Empty, (s, e) => {  
    ...  
    e.KeyExpression = UNIQUE_KEY_COLUMN_NAME;  
}).GetHtml()  
@Html.DevExpress().GridView( _  
    Sub(settings)  
        ...  
End Sub).BindToLINQ(String.Empty, String.Empty,  
New EventHandler(Of DevExpress.Data.Linq.LinqServerModeDataSourceSelectEventArgs)( _  
Sub(s, e)  
        ...  
        e.KeyExpression = UNIQUE_KEY_COLUMN_NAME  
End Sub)).GetHtml()  

“The X has no access to path Y” or “Access to the path X is denied” for File and Image Extensions

Error Description:

The errors occur when you use the following extensions:

Solution:

Make sure that you granted access to the folders specified in the following properties:

You can use the code below in the controller action to check if the specified Web Server’s directory has permissions for file operations:

public ActionResult Index() {
    string dirVirtualPath = "~/TestDir";
    string dirPhysicalPath = Server.MapPath(dirVirtualPath);
    if(!Directory.Exists(dirPhysicalPath)) {
        Directory.CreateDirectory(dirPhysicalPath);
    }
    string fileName = "TestFile.txt";
    string fileFullPath = Path.Combine(dirPhysicalPath, fileName);
    System.IO.File.WriteAllText(fileFullPath, "File Content Here...");
    return View();
} 

Why redirect to another page or View does not work on AJAX requests

This error occurs when you redirect to another page on AJAX requests ( $.ajax()) on the server. For example, when you call the Redirect method in an action method that handles AJAX requests in a controller.

In this case, return to the initial View and then use JavaScript to redirect to another page.

Controller:

return Json(new { newUrl = "https://www.devexpress.com" });  

View:

$.post('@Url.Action("Save")',  
    function (data) {  
        if(data.newUrl)  
            window.location.href = data.newUrl;  
    }  
);  

“Data binding directly to a store query (DbSet, DbQuery, DbSqlQuery, DbRawSqlQuery) is not supported”

Error Description:

This error can occur when you use the Bind method with the non-evaluated / IQueryable Model (for example, a table from a data context) to bind a data-aware DevExpress MVC Extensions (grid-like, scheduler and tree list extensions) to data.

Controller:

public ActionResult GridViewPartial() {  
    EFDataContext db = new EFDataContext();  
    return PartialView(db.Table_Name);  
}  
Public Function GridViewPartial() As ActionResult  
    Dim db As New EFDataContext()  
    Return PartialView(db.Table_Name)  
End Function  

PartialView:

@Html.DevExpress().GridView(settings => {  
    ...  
}).Bind(Model).GetHtml()  
@Html.DevExpress().GridView( _  
    Sub(settings)  
    ...  
End Sub).Bind(Model).GetHtml()  

Solution:

To resolve this issue, you can use the ToList method to load/evaluate a Model.

Controller:

using System.Linq;  
...  
public ActionResult GridViewPartial() {  
    EFDataContext db = new EFDataContext();  
    return PartialView(db.Table_Name.ToList());  
}  
Imports System.Linq  
...  

Public Function GridViewPartial() As ActionResult  
    Dim db As New EFDataContext()  
    Return PartialView(db.Table_Name.ToList())  
End Function  

See Also:

Alert message with the HTML/JavaScript/CSS content appears when you use callback-aware extensions

Solution:

Do the following to solve the issue:

  • The SettingsBase.Name property value should be the same between callbacks.

  • Define extensions in a separate PartialView file without additional tags (for example, HTML markup, scripts).

  • Use the Html.Partial, Html.RenderPartial expression/code block or the Html.Action, Html.RenderAction that return the PartialViewResult to render the PartialView.

  • The action method (CallbackRouteValues.Action) should return the same PartialViewResult that contains the callback-aware extensions.

“An extension with ‘X’ name already rendered”

Error Description:

The error occurs when several DevExpress MVC Extension (for example, TextBox) have the same SettingsBase.Name property value.

PartialView:

@Html.DevExpress().TextBox(settings => {  
    settings.Name = "TextBox";  
}).GetHtml()  

View:

@Html.Partial("EditorsPartial")  
@Html.Partial("EditorsPartial")  

Solution:

An extension’s Name property should be unique to avoid conflicts between extensions in the same view.

  1. Pass a custom “index” value as a parameter to the Html.Partial / Html.Action helper method.

  2. Retrieve the custom value in the Controller / PartialView.

  3. Use the ViewData to pass the custom value to the PartialView.

  4. Use the custom value in the PartialView as a part of the SettingsBase.Name property.

Controller:

public ActionResult EditorsPartial(int part) {  
    ViewData["part"] = part;  
    return View();  
}  
Public Function EditorsPartial(ByVal part As Integer) As ActionResult  
    ViewData("part") = part  
    Return View()  
End Function  

PartialView:

@Html.DevExpress().TextBox(settings => {  
    settings.Name = "TextBox" + ViewData["part"];  
}).GetHtml()  
@Html.DevExpress().TextBox( _  
    Sub(settings)  
            settings.Name = "TextBox" + ViewData("part").ToString()  
    End Sub).GetHtml()  

View:

@Html.Partial("EditorsPartial", new ViewDataDictionary(this.ViewData) { { "part", 1 } })  
@Html.Partial("EditorsPartial", new ViewDataDictionary(this.ViewData) { { "part", 2 } })  

@for (int i = 3; i < 5; i++) {  
    Html.RenderPartial("EditorsPartial", new ViewDataDictionary(this.ViewData) { { "part", i } });  
}  

@* Actions rendering *@  

@Html.Action("EditorsPartial", new { part = 5 })  
@Html.Action("EditorsPartial", new { part = 6 })  

@for (int i = 7; i < 9; i++) {  
    Html.RenderAction("EditorsPartial", new { part = i });  
}  

@* Template rendering *@  

...  
settings.Columns.Add(column => {  
    column.SetDataItemTemplateContent(c => {  
        Html.DevExpress().HyperLink(hl => {  
            hl.Name = "hlNew_" + c.KeyValue.ToString();  
            ...  
        }).Render();  
        ...  
@* Immediate views rendering *@  

@Html.Partial("EditorsPartial", New ViewDataDictionary(Me.ViewData) From {{"part", 1}})  
@Html.Partial("EditorsPartial", New ViewDataDictionary(Me.ViewData) From {{"part", 2}})  

@For i = 3 To 4  
    Html.RenderPartial("EditorsPartial", New ViewDataDictionary(Me.ViewData) From {{"part", i}})  
Next  

@* Actions rendering *@  

@Html.Action("EditorsPartial", New With {.part = 5})  
@Html.Action("EditorsPartial", New With {.part = 6})  

@For i = 7 To 8  
    Html.RenderAction("EditorsPartial", New With {.part = i})  
Next  

@* Template rendering *@  
            ...  
            settings.Columns.Add( _  
                Sub(column)  
                        column.SetDataItemTemplateContent( _  
                            Sub(c)  
                                    Html.DevExpress().HyperLink( _  
                                        Sub(hl)  
                                                hl.Name = "hlNew_" + c.KeyValue.ToString()  
                                                ...  
                                        End Sub).Render()  
                                        ...  

See Also: How to emulate the Command Column with a data column DataItemTemplate

‘System.Web.WebPages.Html.HtmlHelper’ does not contain a definition for ‘DevExpress’

This error can occur in the following cases:

  • ASP.NET MVC 3 projects are upgraded to ASP.NET MVC 4 (or ASP.NET MVC 4 projects to ASP.NET MVC 5)

    Configure the “appSettings” and “assemblies” sections.

    MVC 3 to MVC 4:

    <appSettings>  
        <add key="webpages:Version" value="2.0.0.0" />  
        ...  
    </appSettings>  
    <system.web>  
        <compilation ...>  
            <assemblies>  
                ...  
                <add assembly="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />  
                <add assembly="System.Web.WebPages, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />  
                <add assembly="System.Web.Helpers, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />  
            </assemblies>  
        </compilation>  
    </system.web>  
    

    See Also: Upgrading an ASP.NET MVC 3 Project to ASP.NET MVC 4

    MVC 4 to MVC 5:

    Follow steps listed in the following topic: How to Upgrade an ASP.NET MVC 4 and Web API Project to ASP.NET MVC 5 and Web API 2

  • Areas are used.

    Copy DevExpress namespaces from the ~/Views/Web.config configuration file to ~/Areas/AREA_NAME/Web.config configuration file.

    For ASP.NET MVC 4:

    <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />  
    

    For ASP.NET MVC 3:

    ~/Areas/AREA_NAME/Web.config:

    <system.web.webPages.razor>  
        <host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />  
        <pages pageBaseType="System.Web.Mvc.WebViewPage">  
            <namespaces>  
                <add namespace="System.Web.Mvc" />  
                <add namespace="System.Web.Mvc.Ajax" />  
                <add namespace="System.Web.Mvc.Html" />  
                <add namespace="System.Web.Routing" />  
                <add namespace="DevExpress.Utils" />  
                <add namespace="DevExpress.Web.ASPxClasses" />  
                <add namespace="DevExpress.Web.ASPxGridView" />  
                <add namespace="DevExpress.Web.ASPxGridView.Export" />  
                <add namespace="DevExpress.Web.ASPxEditors" />  
                <add namespace="DevExpress.Web.ASPxCallbackPanel" />  
                <add namespace="DevExpress.Web.ASPxMenu" />  
                <add namespace="DevExpress.Web.ASPxNavBar" />  
                <add namespace="DevExpress.Web.ASPxPopupControl" />  
                <add namespace="DevExpress.Web.ASPxRoundPanel" />  
                <add namespace="DevExpress.Web.ASPxSplitter" />  
                <add namespace="DevExpress.Web.ASPxTabControl" />  
                <add namespace="DevExpress.Web.ASPxTreeView" />  
                <add namespace="DevExpress.Web.ASPxUploadControl" />  
                <add namespace="DevExpress.Web.ASPxHtmlEditor" />  
                <add namespace="DevExpress.Web.ASPxSpellChecker" />  
                <add namespace="DevExpress.XtraCharts" />  
                <add namespace="DevExpress.XtraCharts.Web" />  
                <add namespace="DevExpress.XtraReports" />  
                <add namespace="DevExpress.XtraReports.UI" />  
                <add namespace="DevExpress.XtraReports.Web" />  
                <add namespace="DevExpress.XtraPivotGrid" />  
                <add namespace="DevExpress.Data.PivotGrid" />  
                <add namespace="DevExpress.Web.ASPxPivotGrid" />  
                <add namespace="DevExpress.Web.ASPxPivotGrid.Export" />  
                <add namespace="DevExpress.Web.Mvc" />  
                <add namespace="DevExpress.Web.Mvc.UI" />  
                <add namespace="DevExpress.XtraScheduler" />  
                <add namespace="DevExpress.XtraScheduler.Native" />  
                <add namespace="DevExpress.Web.ASPxScheduler" />  
            </namespaces>  
        </pages>  
    </system.web.webPages.razor>  
    

    See Also: How to use DevExpress MVC Extensions in the ASP.NET MVC Areas