This demo illustrates how to implement cascading combo boxes in the ASPxGridView's EditForm within the Lambda Expressions.
How to populate combo box' column in EditForm based on another column value within Lambdas
How to show / hide control in Column's DataItemTemplate based on value of another control
This demo illustrates how to show/hide a control in the GridViewDataColumn's DataItemTemplate based on the value of another control in the GridViewDataColumn's DataItemTemplate.
How to display and edit persistent objects with many-to-many association in ASPxGridView
This example was created for the ASPxGridView control based on the Knowledge Base article for the XtraGrid: How to display and edit persistent objects with a many-to-many association in the XtraGrid.
How to render CallbackPanel content to Response inside SetContent method via ViewContext
It is possible to write a required content to the Response directly inside the SetContent method via the ViewContext.Writer.
How to show ASPxPopupControl by clicking ASPxHyperLink in grid column's DataItemTemplate
This demo is based on the How to display detail data within a popup window example. It illustrates how to show the ASPxPopupControl whose ContentUrl property is based on the ASPxGridView.DataRow's field values and Session variables by clicking the ASPxHyperLink control in the GridViewDataColumns's DataItemTemplate.
See Also:
How to display detail data within a popup window
Question Comments
Added By: Shawn Collymore at: 6/17/2013 1:24:50 PM
How do you show ASPxPopupControl by clicking the ASPxGridViewTemplateReplacement Button (using ReplacementType="EditFormUpdateButton")
Added By: Larry (DevExpress Support) at: 10/24/2014 7:08:36 AMHello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T165226: How do you show ASPxPopupControl by clicking the ASPxGridViewTemplateReplacement Button. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
How to filter ASPxGridView bound to SqlDataSource via external combobox in ASPxRoundPanel
This example demonstrates how to filter the ASPxGridView bound to SqlDataSource via the ControlParameter. The ControlParameter is passed to the SqlDataSource from an external ASPxComboBox. The ASPxComboBox is inside TemplateControl. Sometimes it's hard to correctly build the ControlParameter's ControlID property manually, so it's better to build it at runtime. In fact, the ControlParameter's ControlID property equals the UniqueID property of an external ASPxComboBox.
ASPxDropDownEdit (Extended Lookup) - How to use ASPxTreeList inside DropDownWindowTemplate
The ASPxTreeList control is placed into the ASPxDropDownEdit's dropdown window template, and a click on a node within the treeList changes the editor's value. A specific client API exposed by the ASPxDropDownEdit is used in this demo to assign a value to the editor (the SetText method), and manipulate the editor's dropdown window (the HideDropDown and AdjustDropDownWindow methods).
Question Comments
Added By: SALİH KAMALI at: 12/28/2017 6:01:30 AM Hello.
How can I fired selectedIndexChanged event when the dropdownedit's selected item changes? We need to use this event in code behind.
Thanks. Added By: Helen (DevExpress Support) at: 12/28/2017 8:46:12 PM
Hello,
I've created a separate ticket on your behalf (T591592: ASPxDropDownEdit (Extended Lookup) - How to use ASPxTreeList control inside the DropDownWindowTemplate - SelectedIndexChanged event). It has been placed in our processing queue and will be answered shortly.
How to implement common scenarios within the grid bound with the EntityDataSource / EF
This is an example for the K18504 How to implement common scenarios when using ASPxGridView bound with EntityDataSource / Entity Framework KB Article. Please refer to the article for an explanation.
ASPxPopupControl/ASPxPopupMenu - Using SetPopupElementID method to change popup element
This example demonstrates the use of the client SetPopupElementID method. This method allows you to programmatically specify the element whose specific mouse action (defined via the PopupAction property) invokes a popup window or popup menu.
In this example, the grid's last column displays image elements, which being hovered, invoke a popup menu, allowing you to manipulate the corresponding grid row (select, unselect or edit the row). The popup menu is associated with the required image element using the menu's SetPopupElementID method.
ASPxGridView - How to implement a custom ASP.NET control like MemoEdit in DataItemTemplate
This example demonstrates how to implement a custom ASP.NET control like MemoEdit in the DataItemTemplate in two different ways - in markup and code behind.
A markup way
Use these steps:
1) Add the ASPxDropDownEdit control to the DataItemTemplate of a column and configure it.
2) Add two custom buttons (Save and Cancel) and the ASPxMemo control to the ASPxDropDownEdit.DropDownWindowTemplate.
3) Handle the Load event of the ASPxDropDownEdit and ASPxMemo controls. In this event handler, get a visible index of the current row (use the approach from The general technique of using the Init/Load event handler). Set a unique ClientInstanceName property based on that visible index.
4) In the Load event handler of the dropdown, add the column's value to the dropdown. Add the JSProperties property to get an index of the dropdown on the client side.
5) Add two global variables. Use the Init event handler to change the visibility of the background image. In the DropDown event, set the current value to the memo. Use the OnSaveClick and OnCancelClick handlers of the ASPxClientButton.Click event to save and hide the dropdown:
[JavaScript]var dropDownEdit;var memo;function OnDropDown(s, e){ SetGlobalVariables(s); memo.SetText(dropDownEdit.GetValue());}function OnCancelClick(s, e){ dropDownEdit.HideDropDown();}function OnSaveClick(s, e){ dropDownEdit.SetValue(memo.GetValue()); SetInputDisplayFormat(dropDownEdit); dropDownEdit.HideDropDown();}function SetInputDisplayFormat(dde){var input = dde.GetInputElement(); input.style.display = (input.value != "") ? "none" : "block";}function SetGlobalVariables(dde){ dropDownEdit = dde; memo = ASPxClientControl.GetControlCollection().GetByName("memo_" + dde.cpIndex);}
6) Add the following CSS rules on the page and assign the CSS class to the ASPxMemo control:
[CSS].memotextarea{padding:0px!important;resize:both;margin:0px!important;}.memotd{padding:0px!important;}
This workaround adds the resize "grip" at the bottom right of this control.
A code-behind way
Use the following steps:
1) In code behind, add two ITemplate classes. The first class will implement a template for the grid, the second - for the dropdown.
2) Handle the DataBinding event of the grid. In the event handler, add the first class instance to the target column.
3) In the first class, define ASPxDropDownEdit (based on The general technique of using the Init/Load event handler) and find a visible index (use the approach from the How to create controls dynamically KB article). Define all the necessary properties. Create a unique ID and ClientInstanceName based on the visible index and handle client-side events. Add the JSProperties property to get an index of the dropdown on the client side. Add the second class instance to the ASPxDropDownEdit.DropDownWindowTemplate.
4) Add the constructor and a private variable to the second class to take the container of the dropdown to define a visible index.
5) In the second class, define ASPxMemo and two buttons. Find a visible index of the grid. Define all the necessary properties. Create a unique ID and ClientInstanceName based on the visible index and handle client-side events.
6) Repeat steps 5 and 6 from the approach with markup.
ASPxFileManager - How to implement a custom provider with Azure File storage/ File Service
This example describes how to use our file manager control with the Azure File storage / File Service. The main idea is to create a custom file system provider and use Azure SDK to implement all required operations. As a starting point, it is possible to use the Get started with Azure File storage on Windows Microsoft documentation.
To run the example, define the AccountName, KeyValue, and FileShare constants with your credentials in the AzureFileStorageProvider class.
Please note that the Azure Blob Storage is supported in our ASPxFileManager by default. You can review our Demo, where it is shown how to configure the file manager in this case.
See also:
ASPxFileManager - How to implement a List data bound custom file system provider
ASPxFileManager - How to implement a LINQ to SQL based file system provider
ASPxGridView - Save selection to the database when ProcessSelectionChangedOnServer is True
This example shows how to save and retrieve a selection state of a row. It is realized by using the ProcessSelectionChangedOnServer property. On page loading, a selection state is retrieved from the database and the ASPxGridView rows are selected by the SetSelection method. When row selection is changed on the client side, the grid performs a callback to the server and the database is updated on that callback.
See also:
ASPxGridView - How to save selected rows to the database by using WebMethods
ASPxTreeList - XmlDataSource - How to implement CRUD, drag-and-drop and other operations
This example describes how to implement CRUD, drag-and-drop and sorting operations with updating an Xml file in ASPxTreeList bound to XmlDataSource. XmlDataSource doesn't support the CRUD and drag-and-drop operations out of the box. So, corresponding custom operations are implemented. Sorting of an Xml file also requires custom implementation.
To complete the task, follow the next steps:
1) To implement CRUD and drag-and-drop, handle the NodeInserting, NodeUpdating, NodeDeleting and ProcessDragNode events. Node names are based at the nodes' levels. It is necessary to manually change a node name after the drag-and-grop operation has been performed.
2) To change an Xml file, use the XmlDocument class. To find a single node, use the XPath expression.
3) To implement sorting with updating an Xml file, it is necessary to update the source after every change of existing data. So, perform node sorting and data updating after every CRUD and drag-and-drop operation. The ascending sorting by the ItemNumber attribute of the Xml node is implemented in the example.
Note:
In the example, a custom ExampleSessionStorage class is used as temporary in-memory data storage to prevent changing of the original data file. This class is not required in a real application.
How to handle application-level errors occurred inside ASP.NET MVC controls during callbacks
This example is an MVC version of the How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing WebForms solution.
It illustrates how to catch and handle:
- Exceptions that occur inside DevExpress ASP.NET MVC extensions during a callback using the ASPxWebControl.CallbackError event;
- The remaining unhandled exceptions using the Application_Error event in the Global.asax file.
It also shows how to write required information to the same log/storage (for further diagnostics, etc).
Global.asax:
[C#]protectedvoidApplication_Start(){ASPxWebControl.CallbackError+=Application_Error;}
[VB.NET]ProtectedSub Application_Start()AddHandler ASPxWebControl.CallbackError, AddressOf Application_ErrorEndSub
[C#]protectedvoidApplication_Error(objectsender,EventArgse){Exceptionexception=HttpContext.Current.Server.GetLastError();if(exceptionisHttpUnhandledException)exception=exception.InnerException;AddToLog(exception.Message,exception.StackTrace);}
[VB.NET]ProtectedSub Application_Error(ByVal sender AsObject, ByVal e As EventArgs)Dim exception As Exception = HttpContext.Current.Server.GetLastError()If TypeOf exception Is HttpUnhandledException Then exception = exception.InnerExceptionEndIf AddToLog(exception.Message, exception.StackTrace)EndSub
The only difference is the format of the callbackErrorRedirectUrl configuration option. It should be set according to the routing configuration:
Web.config:
[XML]<configuration><devExpress><errorscallbackErrorRedirectUrl="/Home/Error"/></devExpress></configuration>
Note that this approach won't catch exceptions thrown in a controller action when customErrors.mode is On. To handle controller exceptions in this case, add a custom error filter into FilterConfig:
[C#]publicclassFilterConfig{publicstaticvoidRegisterGlobalFilters(GlobalFilterCollectionfilters){filters.Add(newHandleErrorAttributeEx());}publicclassHandleErrorAttributeEx:HandleErrorAttribute{publicHandleErrorAttributeEx():base(){}publicoverridevoidOnException(ExceptionContextfilterContext){base.OnException(filterContext);filterContext.ExceptionHandled=false;}}}
This will make action errors raise the Application_Error event.
WebForms Version:
How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing
Question Comments
Added By: Mike McGrath at: 9/15/2015 9:11:57 AM
Our application is a web forms. What is required (DevExpress dlls) to support this
Added By: Sergi (DevExpress Support) at: 9/15/2015 9:20:42 AM Hello Mike,It seems that I provided you with the incorrect link in the T290000: ASPxUploadControl - The file upload cannot be completed due to an operation timeout - display this error to client ticket. I have updated the answer there.
How to handle application-level errors occurred inside ASP.NET WebForms controls during callbacks
This example illustrates how to catch and handle:
- Exceptions that occur inside DevExpress ASP.NET controls during a callback using the ASPxWebControl.CallbackError event;
- The remaining unhandled exceptions using the Application_Error event in the Global.asax file.
It also shows how to write required information to the same log/storage (for further diagnostics, etc).
Global.asax:
[C#]voidApplication_Start(objectsender,EventArgse){// Assign Application_Error as a callback error handlerASPxWebControl.CallbackError+=newEventHandler(Application_Error);}
[VB.NET]Sub Application_Start(ByVal sender AsObject, ByVal e As EventArgs)' Assign Application_Error as a callback error handlerAddHandler ASPxWebControl.CallbackError, AddressOf Application_ErrorEndSub
[C#]voidApplication_Error(objectsender,EventArgse){// Use HttpContext.Current to get a Web request processing helperExceptionexception=HttpContext.Current.Server.GetLastError();if(exceptionisHttpUnhandledException)exception=exception.InnerException;// Log an exceptionAddToLog(exception.Message,exception.StackTrace);}
[VB.NET]Sub Application_Error(ByVal sender AsObject, ByVal e As EventArgs)' Use HttpContext.Current to get a Web request processing helperDim exception As Exception = HttpContext.Current.Server.GetLastError()If TypeOf exception Is HttpUnhandledException Then exception = exception.InnerExceptionEndIf' Log an exception AddToLog(exception.Message, exception.StackTrace)EndSub
By default, an unhandled exception occurs while a callback is displayed using the "alert" message.
In order to execute redirect to a custom error page, specify the callbackErrorRedirectUrl configuration option:
Web.config:
[XML]<configuration><devExpress><errorscallbackErrorRedirectUrl="~/ErrorPage.aspx"/></devExpress></configuration>
Note: some controls (for example ASPxUploadControl) utilize the capabilities of the DevExpress.Web.ASPxUploadProgressHttpHandler handler to perform actions on a callback. System-level exceptions (request timeout, session timeout, etc.) that occur while executing the DevExpress.Web.ASPxUploadProgressHttpHandler handler can't be handled using the ASPxWebControl.CallbackError event. Use the default Application_Error event handler for this purpose.
MVC Version:
How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing
Question Comments
Added By: okan sarıca at: 7/13/2012 2:21:38 AM
i handle the exception in global asax but how can i send message to callbackcontrol for example ? if i throw a new exception in global asax e.message in callbackError function is 'some error occured'
Added By: Eric Malgeri 1 at: 8/17/2017 8:53:27 AM Hello,I have tried to implement this sample code to my project where I am processing a lot of files within the
Added By: Nataly (DevExpress Support) at: 8/17/2017 2:01:45 PMCallbackControl_Callback() method on the server. This process can take a while and a timeout can occur. When the timeout does occur, it appears that the error handling does redirect the application to the error page, but the memo box is empty. This indicates that the Application_Error method was not invoked. I have code in that method to display the exception message in the memo box on the error page.
CallbackControl_Callback() method where it should then be handled by the Application_Error() method contained in the Global.asax.cs file?
How can timeout events be trapped and explicit error messages set or exceptions be caught when co de is executing in the
Hello,
I've created a separate ticket on your behalf (T546798: How to use the ASPxWebControl.CallbackError event to handle application-level errors occurred inside ASPxWebControls during callback processing). It has been placed in our processing queue and will be answered shortly.
How to refer to a client-side control encapsulated in certain instance of UserControl
This is an example for article How to refer to a client-side control within a UserControl. There is a UserControl with an ASPxPopupControl control. Two instances of the UserControl are put on a page. Each UserControl instance deals with its own popup control. Note the dynamically generated handler for the button's client-side Click event and EditPropertiesBase.ClientInstanceName in WebUserControl.ascx code behind.
See Also:
Client-Side API Availability for a Web Control
K18282 - The general technique of using the Init/Load event handler
Question Comments
Added By: Jay Johnson at: 6/10/2015 2:30:42 PM
Trying this with an ASPxRadioButton and getting "Databinding expressions are only supported on objects that have a DataBinding event. DevExpress.Web.CheckEditClientSideEvents does not have a DataBinding event."
Any ideas?
Added By: Jay Johnson at: 6/10/2015 2:31:38 PM<dx:ASPxRadioButton ID="optNo" runat="server" Text="No" GroupName="Answer" Layout="Flow" Theme="MetropolisBlue" >
<ClientSideEvents CheckedChanged= '<%#GetButtonClickHandler()%>' />
</dx:ASPxRadioButton>
Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T254117: The "Databinding expressions are only supported on objects that have a DataBinding event. DevExpress.Web.CheckEditClientSideEvents does not have a DataBinding event." error occurs. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
This works for controls where you can bind the function. However it not explain how to bind the javascript function on grid callbacks.
If you have this situation, I have no idea how to adapt openComisarioDetalle:
<script id="dxss_personaluploaderscript" type="text/javascript">
function gridComisionadosCustomButtonClick(s, e) {
gridcomisarios.GetRowValues(e.visibleIndex, "idrecord;name;surname", openComisarioDetalle);
}
function openComisarioDetalle(values) {
//some code here
}
</script>
<dx:ASPxGridView ID="gridcomisarios" runat="server" AutoGenerateColumns="False"
Width="100%" EnableTheming="True" ClientInstanceName="gridcomisarios" EnableViewState="False" Cursor="pointer">
<ClientSideEvents CustomButtonClick="function(s, e) { gridComisionadosCustomButtonClick(s, e); }" />
Hello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T279924: How to create a javascript function in code behind. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
How to use an external ASPxProgressBar control with an ASPxUploadControl
In this example, the ASPxProgressBar control is used to visualize the progress of file uploading initiated within the ASPxUploadControl. The UploadingProgressChanged client event of the ASPxUploadControl is handled to supply the ASPxProgressBar control with the current progress information. Using the ASPxProgressBar as a separate control allows placing it at any desired position within the page.
To enable the progress panel functionality and make the client UploadingProgressChanged event fire, the special ASPxUploadProgressHttpHandler and ASPxHttpHandlerModule should be registered within a web project's Web.Config file. See the "Web.config" tab for more detail.
How to define multiple invoker elements to implement image zooming for a set of images
This example demonstrates how to implement a kind of an image gallery with an image preview.
Image thumbnails are displayed by ASPxDataView that is used in Flow layout mode. In this mode, image thumbnails flow one after another, to fill the available page area within the browser window in the best possible way. When hovering a thumbnail, ASPxPopupControl is invoked to display a large (zoomed) image. During zoomed image loading, ASPxPopupControl displays a thumbnail image enlarged to the zoomed image size.
The specificity of this example is that image previews are displayed with the help of a single ASPxPopupControl that is dynamically linked to multiple invoker elements via client code. The client SetPopupElementID method is used to associate ASPxPopupControl with multiple instances of a thumbnail image element placed within ASPxDataView's ItemTemplate.
From this example, you can also learn how to dynamically generate two images - thumbnail and preview - from an original image and how to apply a watermark to a large preview image.
Question Comments
Added By: Eduardo Dajles at: 5/23/2013 11:02:03 AM
~/App_Data/Gallery.xml file is missing
How to implement the Master-Details functionality with the ServerMode enabled
One of known Server Mode limitations is the inability to use such sources in the master and detail grids. In this example, we demonstrated how to avoid this limitation by displaying detailed information in a custom RowDetailsTemplate (in versions where this property does not exist, DataRowTemplate is used).
In this example, we used the AdventureWorks database, which can be downloaded at AdventureWorks DB, LINQ to SQL classes, and LinqServerModeSource - a synchronous Server Mode source designed for LINQ to SQL.