Common Client-Side Issues
- 4 minutes to read
The links below describe how to solve common client-side issues:
The “X is undefined” error occurs or controls are rendered with incorrect styles
Cannot access DevExpress ASP.NET controls on the client
The “ReferenceError: ‘X’ is not defined” error message appears when the Control.Enabled property is set to false
The “X is undefined” error occurs or controls are rendered with incorrect styles
Possible Errors:
“‘aspx***’ is undefined”
“ASPxClient*** is undefined”
The default styles/images/scripts for DevExpress ASP.NET controls are not loaded.
Solution:
Check the following to solve this issue:
Make sure the ASPxHttpHandlerModule is registered in Web.config.
The ASPxHttpHandlerModule allows DevExpress ASP.NET controls to load their resources. The Web.config file should contain a reference to this module in the system.web/httpModules and system.webServer/modules (for IIS7 in integrated mode) sections. Registration is automatic if you place a DevExpress control on a form in Design view or if you use Project Templates to create an application. You can register the module if you create controls at runtime.
IIS (classic mode)
<system.web> <httpHandlers> <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.vX.Y, Version=X.Y.Z.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" validate="false" /> </httpHandlers> <httpModules> <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.vX.Y, Version=X.Y.Z.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/> </httpModules> </system.web>
IIS7 (integrated mode)
<system.web> <httpHandlers> <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.vX.Y, Version=X.Y.Z.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" path="DX.ashx" validate="false" /> </httpHandlers> <httpModules> </httpModules> </system.web> <system.webServer> <validation validateIntegratedModeConfiguration="false" /> <handlers> <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.vX.Y, Version=X.Y.Z.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" verb="GET" name="ASPxHttpHandlerModule" path="DX.ashx" preCondition="integratedMode" /> </handlers> <modules> <add type="DevExpress.Web.ASPxHttpHandlerModule, DevExpress.Web.vX.Y, Version=X.Y.Z.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" name="ASPxHttpHandlerModule"/> </modules> </system.webServer>
Make sure the application’s folder is marked as a separate IIS application.
Add “Full control“ permission for the “IIS_IUSRS“ account in the application folder.
Rewrite URL. Add an exception for the DXR.axd URL if you specify a Rewrite URL rule in your Proxy Layer/URL Rewrite Module that blocks/rewrites requests from resource handlers:
- WebResource.axd (for standard handlers);
- DXR.axd (for the DevExpresss ASPxHttpHandlerModule).
See Also:
Cannot access DevExpress ASP.NET controls on the client
Error Description:
This error occurs when you try to use the following methods/events:
The ClientScriptManager.RegisterStartupScript method.
The window.onload event.
The $(document).ready() jQuery function.
Solution:
This error occurs because DevExpress ASP.NET controls are not completely initialized on the client when you call the startup script, window.onload or document.ready. We do not recommended that you use these APIs with our controls on the client while other controls are still active. These approaches are not reliable and can lead to invalid access to controls on the client.
Use any of the following solutions to resolve the issue:
Handle the client-side Init event to initialize the control on the client when a page loads.
<dx:ASPxTextBox ID="TextBox" runat="server" ...> <ClientSideEvents Init="OnTextBoxInit" /> </dx:ASPxTextBox>
function OnTextBoxInit(s, e) { s.SetText('...'); }
Handle the ControlsInitialized event to make sure that all DevExpress web controls are initialized and accessible on the client.
<dx:ASPxTextBox ID="TextBox" runat="server" ClientInstanceName="TextBox"> </dx:ASPxTextBox> <dx:ASPxGlobalEvents ID="GlobalEvents" runat="server"> <ClientSideEvents ControlsInitialized="OnControlsInitialized" /> </dx:ASPxGlobalEvents>
function OnControlsInitialized(s, e) { TextBox.SetText('...'); }
Or:
<dx:ASPxTextBox ID="TextBox" runat="server" ClientInstanceName="TextBox"> </dx:ASPxTextBox>
ASPxClientControl.GetControlCollection().ControlsInitialized.AddHandler(function(s, e) { TextBox.SetText('...'); }
Note
The ControlsInitialized event is raised each time DevExpress controls send a request to the server. You can use the constructor(isCallback) parameter to determine if an event is raised as a result of a DevExpress callback.
See Also:
- How To: Use jQuery/jQuery UI libraries with DevExpress ASP.NET Controls/MVC Extensions
- How To: perform user actions after each callback (like MVCxGlobalEvents)
The “ReferenceError: ‘X’ is not defined” error message appears when the Control.Enabled property is set to false
Error Description:
The “ReferenceError: X is not defined” error message appears when you try to access a DevExpress ASP.NET control whose Enabled property is set to false.
Solution:
Client scripts are not rendered for a control if its Enabled property is set to false. This means you cannot access the control on the client. Instead, use the ClientEnabled property to disable the control and make it available on the client.
See Also: