Quantcast
Channel: DevExpress Support Center (Examples)
Viewing all 7205 articles
Browse latest View live

How to notify about changing an updated record and allow overriding the changes without a refresh

$
0
0

The example demonstrates a solution for the following task.


We have two (or more) users who are editing the same data row in GridView. While the first user is typing new values, the second user has committed his changes. When the first user commits his changes, a notification popup dialog will be shown. A user can override the second user's changes without refreshing the grid.


Please note that this example does not demonstrate how to check data in a database. It is assumed that it is known that data has been changed.


How to bind ASPxGridView created at design mode to different data sources at runtime.

$
0
0

How to bind ASPxGridView with autogenerated columns to different data sources at runtime. The grid is created at design mode.

This example shows how to select and bind ASPxGridView to a data source at runtime. The page contains ASPxGridView, ASPxRadioButtonList and three data sources (SqlDataSource). Grid's data source is changed by clicking list items. Note that EnableViewState grid's property is set to false. It is done to avoid exceptions on binding the grid to another data source.

Grid's column is autogenerated.

See also:
How to dynamically switch the grid's data source and recreate columns at runtime
How to bind ASPxGridView with manually created columns to different data sources at runtime. The grid is created in design mode.
How to bind ASPxGridView with autogenerated columns to different data sources at runtime. The grid is created in runtime mode

How to bind ASPxGridView with manually created columns to different data sources

$
0
0

This example shows how to select and bind ASPxGridView to a data source at runtime. The page contains ASPxGridView, ASPxRadioButtonList and three data sources (SqlDataSource). In design mode the grid doesn't have any column. You should add all columns manually by using an appropriate algorithm. We have created columns as this is done in selected data columns. If a data source has insert, update or delete command, a command column will be appended to the grid.
Grid's data source is changed by clicking list items. Note that the EnableViewState property is set to false. It is done to avoid exceptions on binding the grid to another data source.

See also:
How to dynamically switch the grid's data source and recreate columns at runtime
How to bind ASPxGridView with autogenerated columns to different data sources at runtime. The grid is created at design mode
How to bind ASPxGridView with autogenerated columns to different data sources at runtime. The grid is created in runtime mode

Question Comments

Added By: Bjorn Padding at: 11/4/2015 11:49:35 AM    

I have a XAF application and require the same of what is asked here (https://www.devexpress.com/Support/Center/Question/Details/T216541) by Yasir 9 months ago, to create a timesheet with a UX friendly interface like this one here (https://www.devexpress.com/Support/Center/Attachment/GetAttachmentFile/badaed21-c3f3-11e4-80ba-00155d624807). Even if I would choose to go down this (from a XAF perspective) hackery route of implementing what I want in this application, how would I even seamlessly integrate that under a clickable navigation item in my XAF application? I have tried to approach my problem from several perspectives with my multi-platform knowledge and I have a very hard time coming a acceptable solution. My timesheet reporting tool also has several association to different tables for its projects and users and a bunch of other stuff and this solution would basically make the application error-prone when somebody makes a change to this part of the program, not knowing that he has to modify all kinds of SQL-code in a ASPx page somewhere else. I am even volunteering for the job to write a nice XAF extension for this, but also this seems like it would be a living nightmare to do in comparison to other platforms, like nodejs, for instance, or even PHP or what have you.

As I said. I am willing to volunteer for the task, but then I obviously will need youur help on how to write a nice controller for this that would support both web and win modules.

I hope to hear from somebody.

Best,
B

Added By: Helen (DevExpress Support) at: 11/5/2015 1:05:08 AM    

Hello Bjorn,

To process your recent post more efficiently, I created a separate ticket on your behalf: TimesheetControl (no not SchedulerControl). This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

ASPxGridView - How to highlight a row when a user checks a templated ASPxCheckBox

$
0
0

The example's page contains ASPxGridView with ASPxCheckBox placed into a column's DataItemTemplate. It addition, there is ASPxCallback on the page. If a row ASPxCheckBox is checked, a callback to the server is sent via ASPxCallback to update a database. At the same time, a parent row's background color is changed on the client side without refreshing ASPxGridView.

Please note that row highlighting is based on the jQuery library.

How to implement percentage values calculation in a GridView unbound column for a group

$
0
0

In this example, we have an ASPxGrid bound to SqlDataSource. The data source returns columns. We grouped the grid by one of them. Also, the grid contains an additional unbound column 'percent'. It contains the ratio of the 'UnitPrice' column's value to total 'UnitPrice' column's values for this group. If the grid doesn't have any groups, the 'percent' column will contain the ratio of the 'UnitPrice' column's value to total 'UnitPrice' column's values of the grid.

How to implement a dynamical DataItem template for several same-type columns

$
0
0

This example demonstrates how to implement dynamical DataItem template for several columns of the same type. In this example ASPxCheckBox is shown only if its cell contains the true value. If additional GridViewDataCheckBoxColumns are appended, the template will be applied to them as well.

How to display a report that uses a private (embedded) font in a DocumentPreview

ASPxGridView - How to show the date range header filter’s dates in filter row editors

$
0
0
By default, ASPxGridView doesn't provide functionality to show start and end dates from the header date range filter in the filter row because only one date editor is displayed in this row. This example illustrates how to display these dates in custom date editors in the filter row once the header date range filter is applied and synchronize these editors' values with the date editors located in the header filter popup.

To accomplish this task, you can add two custom ASPxDateEditors in an appropriate column's FilterTemplate as demonstrated in the Date Range Filtering in the Filter Row example. Process the applied date range filter in the grid's CustomJSProperties event handler and pass the filter dates to the client side by using JSProperties. Then, set your custom ASPxDateEditor filter row editors in the client-side EndCallback even handler based on the passed JSProperties. You can apply the filter set by these custom filter row editors as demonstrated in the Date Range Filtering in the Filter Row example.

Report Server - Get the list of reports and display a preview in a WinForms application

$
0
0

The sample demonstrates how to use the Report Server WCF API in a Windows Forms application.

Question Comments

Added By: Juan Carlos Cabrera 1 at: 4/21/2014 5:13:55 PM    

Hello!!... I have a question... What is ReportViewerForm?. Thanks

Added By: Igor D (DevExpress) at: 4/22/2014 1:22:12 AM    

Hi!
 
ReportViewerForm, as the name suggests, is a form with the DocumentViwer control. Please download the example to see the full source code.

Added By: Juan Carlos Cabrera 1 at: 4/22/2014 8:35:33 AM    

ooohhh!!... very good... it ́s great. Thanks

Added By: Pavan kumar 54 at: 8/12/2015 5:41:39 AM    

Thank you for the response, Don't i get an example in asp.net c# as our application is an asp.net application. Please suggest if you can help me this

Added By: Dmitry Tok (DevExpress Support) at: 8/12/2015 6:53:11 AM    

Hello Pavan,

We have a corresponding Code Example available for web platform Report Server - How to get the list of available reports and display a report preview in an ASP.NET MVC application. It would be great if you register a separate thread regarding the issue if this example doesn't help.

Thanks,
Dmitry

Added By: Pavan kumar 54 at: 8/19/2015 1:26:48 AM    

Hello Dmitry,

I have no experience with MVC and require asp.net code for me to close this thread. Please provide asp.net sample for this issue.Very important .

Thanks
Pavan

Added By: Yaroslav (DevExpress Support) at: 8/19/2015 3:33:22 AM    

Hi  Pavan,
I see that you've published exactly the same request in the How can i bind all the reports created in report server in my custom application thread. Let's continue our conversation there. 

Added By: celso coelho 1 at: 10/26/2016 2:36:39 AM    Is it possible to print the report directly without preview insted of export to pdf?Added By: Jannet (DevExpress Support) at: 10/26/2016 6:48:03 AM    Hello Celso,
I see that you submitted a separate ticket regarding this task: Print Report Server direcly without preview. Let's continue our discussion there.Added By: John Molloy 2 at: 8/23/2017 5:40:30 AM    

Hi
I am using this to get a list of Reports, form the Server, but it onlys seems to give Reports no Dashboards
?

Added By: Dmitry Tok (DevExpress Support) at: 8/23/2017 6:19:59 AM    Hi John,

This Code Example demonstrates how to obtain the reports only. The API for obtaining the dashboards isn't ready yet and for now there is no way to achieve this goal. 

ASPxGridView - How to prevent moving a certain column in the Customization Window

$
0
0

This example demonstrates how to prevent moving certain ASPxGridView columns to the Customization Window.
To accomplish this task, you can handle the client-side ColumnMoving event handler and set the eventArgs e.allow property to false based on the currently moved column name that can be obtained via the e.sourceColumn.fieldName property.

The example also demonstrates how to check how many columns are left visible in the grid and prevent moving the last column. This task can be accomplished by obtaining the current visible column count in the server-side AfterPerformCallback event handler and passing it to the client side via JSProperties. Then, it's possible to check this value in the ColumnMoving event handler to stop moving.

ASPxRichEdit - Save the words added via the "Add to Dictionary" to a physical dictionary

$
0
0
Currently, ASPxRichEdit doesn't save words added by a user via the "Add to Dictionary" option in the physical dictionary file and stores these changes in a Session variable.

If it's necessary to save changes from the temporary dictionary stored in Session to a physical dictionary file on demand, you can accomplish this task programmatically, for example, on a button click. Get the temporary dictionary that has the SpellCheckerCachedCustomDictionary type from Session in the following way:
[C#]
SpellCheckerCachedCustomDictionarydic=Session[ASPxRichEdit1.Settings.SpellChecker.Dictionaries[0].CacheKey]asSpellCheckerCachedCustomDictionary;
Note that you need to pass an index of your custom dictionary to the collection of other dictionaries used in your project as the Dictionaries collection index in this code.

Then, pass words from that temporary dictionary to a new instance of your custom dictionary class derived from SpellCheckerCustomDictionary and save this custom dictionary to the appropriate physical path obtained from the temporary dictionary's DictionaryPath property:
[C#]
MyCustomDictionarydictionary=newMyCustomDictionary();for(inti= 0;i<dic.WordCount;i++)dictionary.AddWord(dic[i]);dictionary.SaveAs(dic.DictionaryPath);

ASPxGridView - How to change modified cell styles dynamically in Batch Edit mode

$
0
0

If you're applying custom conditional formatting to ASPxGridView cells by using the HtmlDataCellPrepared event handler, this formatting will not be applied to the modified cells in Batch Edit mode because these modifications are stored on the client side until you press the "Save Changes" button.
In order to apply the same formatting to the modified values in this mode, it's necessary to set their style dynamically in the client-side BatchEditEndEditing event handler.
Add a custom attribute to each cell of the formatted column in the HtmlDataCellPrepared event handler as demonstrated in the ASPxGridView - How to set a different color for the modified cell in different columns in Batch Edit mode example. Set the grid's Styles.Row.CssClass property, and use this class and attribute to access the currently edited row's cell on the client side. Then, set the modified cell's style in the client-side BatchEditEndEditing event handler based on the newly entered value.

ASPxRichEdit - How to define the default page settings such as margins, paper kind etc

$
0
0

It's possible to use the non-visual RichEditDocumentServer component to adjust the required document settings. Create a new document using RichEditDocumentServer and adjust its page by using the corresponding API.
Refer to the following documentation articles, where you can learn how to set the required properties:

Document 
DefaultCharacterProperties

This example demonstrates how to set a document page's landscape, paper kind, margins and font properties.

ASPxGridView - How to bind a combobox column based on a row index in Batch Edit mode

$
0
0

The attached example illustrates how to populate GridViewDataComboBoxColumn at runtime when ASPxGridView is used in Batch Edit mode.

The technique of completing this task in a batch grid differs from the approach used for a grid in standard mode. When the grid is used in Batch edit mode, ASPxGridView performs all operations on the client side. Therefore, it's not possible to populate the combo box located in each row using the CellEditorInitialize event handler.
As a solution, the combo box can be populated on its callback.
This scenario requires the following steps:
1) Add the combo box' Callback event handler in the grid's CellEditorInitialize event handler.
2) Initiate a callback to the combo box by calling its PerformCallback method in the client-side ASPxClientGridView.BatchEditStartEditing event handler. Pass a row's visible index obtained via e.visibleIndex as a parameter of this method.
3) Add required items to the combo box in its server-side Callback event handler. You can get the current row index from the callback parameter (e.Parameter).

Question Comments

Added By: Cheung Wai Shing at: 7/30/2015 10:41:03 PM    

Hi. I have try this sample.  It seems got problem when press the new button.

Added By: Larry (DevExpress Support) at: 7/30/2015 11:22:59 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T273448: T190978 example - Incorerct index is shown when clicking the new button. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

ASPxGridView - How to use Batch mode on editing and Edit Form mode on inserting a new row

$
0
0

This example demonstrates how to use ASPxGridView in different modes on editing and inserting a new row.
In the illustrated scenario, the grid edits rows in Batch mode and inserts them using the edit form. For this purpose, ASPxGridView is nested in ASPxCallbackPanel and its mode is switched on the callback panel's callback.
A custom New button is placed in the command column's HeaderTemplate. On the New button's click, you can check if ASPxGridView has unsaved changes using the client-side HasChanges method and call the UpdateEdit method to save these changes or initiate the ASPxCallbackPanel's callback to add a new row.

Question Comments

Added By: Quasar Wong at: 5/3/2015 6:58:24 PM    

Hi I have tested this function and find that the update button not work on inserting a new row. Thanks.
p.s. I am using v14.2.7

Added By: Larry (DevExpress Support) at: 5/3/2015 11:19:54 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T237227: ASPxGridView - The T191177 example - The update button does not work on inserting a new row. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.


ASPxGridView - How to filter a date column by both date and time in the auto filter row

$
0
0
By default, GridViewDataDateColumn filters data by string and cuts off information about minutes and seconds (keeping only the hour part).
As a solution, you can modify the filter criteria in the ASPxGridView.ProcessColumnAutoFilter event handler to keep the time part in the filter row date values and take the time part into account when filtering.

To allow the user to define both date and time in the filter row not only by manually typing them in the input but also by using the date editor shown in the drop down, use the ASPxGridView.AutoFilterCellEditorInitialize event. Access the default ASPxDateEdit control displayed in the drop down and enable its time section by setting the TimeSectionProperties.Visible property to true.

How to override the Report Designer command handlers

$
0
0

This example illustrates how to create a custom command provider inherited from the ReportDesignerCommands class and override some of its methods.

How to hide specific export formats from the Document Preview Control

$
0
0
This example illustrates how to hide particular export formats from the drop-down list on the toolbar and in the Export Options window.

How to prevent the server ItemClick event for the menu items that have sub-items

$
0
0

This sample demonstrates how to disable sending a postback and generating the server ItemClick event for the menu items that contain sub-items. In this sample, the desired behavior is implemented by setting the e.processOnServer parameter to false within the handler of the menu client ItemClick event.

Data Source Wizard - How to display a list of available tables after data base selection

$
0
0

To customize the data source wizard use the DashboardDesigner.DataSourceWizardCustomization property
When a data source is selected, a custom ConfigureQueryPageView is shown. This view displays a list of tables from the selected data source, and automatically generates a query when a certain table is selected. 

Viewing all 7205 articles
Browse latest View live