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

OBSOLETE - How to use VGridControl instead of the LayoutControl in the DetailView

$
0
0

========================================

This example is now obsolete and is no longer maintained, because this custom VGridControl layout implementation is now quite rare. Second, it is better to implement a custom LayoutManager for this task, rather than embedding a fake ViewItem into the existing DetailView layout.

========================================
In this example, I have created a custom ViewItem based on the VGridControl.
The idea is to remove all layout items that you want to show in the vertical grid and instead of them place our single ViewItem onto the layout.
Then, all the editors for business object properties will be generated with the help of the VGridControl.

To use this custom item, you should customize the required DetailView in the Model Editor as shown in the WinSolution.Module.Win\Model.DesignedDiffs.xafml file.

See Also:
How to integrate a Vertical Grid control into an XAF application


How to provide the capability to create fixed rows in the GridView

$
0
0

The current example illustrates how to implement a functionality for creating fixed rows, which will be displayed on top of the GridView.

Question Comments

Added By: Vlad Gonchar at: 12/12/2013 12:09:54 PM    

Thank you for proposed code, but it does not work properly for few reasons:

1. Method UpdateFindControlVisibility used in GridViewInfoFixedRows class is not defined in the code you provided

2. I added new bool column at the and of DataTable, assigned it to grid's DataSource, then I changed VisibleIndex for the column to 0 to have it first in a row, but in fixed row this column's value is still shown at the end of row as word "false"/"true".

Regards,
Vlad

Added By: Vlad Gonchar at: 12/13/2013 9:17:25 AM    

There is more failures in this code:

3. The fixed row does not move together with other rows when I move horizontal scroll bar

Added By: Jackson Cheng at: 5/15/2015 1:15:14 AM    

Me too. When I scroll the grid horizontally the column header moves in a different rate than the cells.

Added By: Vova (DevExpress Support) at: 5/18/2015 6:11:07 AM    

Hello,

We are looking for a possible solution to this issue. However, this may take some time.

We will let you know once we have any results. Your patience is greatly appreciated. 

Added By: Vova (DevExpress Support) at: 5/22/2015 7:43:23 AM    

Hello,

Thank you for your patience.

We've updated the example to improve the columns width's synchronization.

We are looking forward to your feedback.

Added By: Simon Hewitt at: 5/19/2017 9:26:36 AM    This is good but the column resize splitter does not work other than in header & top panel (if visible)

How to display the Stacked Bar total value labels

ListBoxDragDropManager - How to reorder items

$
0
0

The current ListBoxDragDropManager version does not provide the capability to reorder items. This example demonstrates how to implement this functionality manually.

In this example, we have created a ListBoxDragDropManager class descendant and overridden its OnDragOver and OnDrop methods to add the capability to drop an item before or after another item.

You can use this class like the original ListBoxDragDropManager in the following manner:

[XAML]
<dxe:ListBoxEditx:Name="editor1"DisplayMember="Name"><dxmvvm:Interaction.Behaviors><local:MyListBoxDragDropManagerx:Name="manager1"/></dxmvvm:Interaction.Behaviors></dxe:ListBoxEdit>
Question Comments

Added By: Nils Kraus at: 3/18/2015 7:43:12 AM    

how would one go about implementing EXACTLY THIS behavior for a TreeListControl?

thanks in advance.

Added By: Ivan (DevExpress Support) at: 3/18/2015 9:35:30 AM    Hi Nils.
I see that you posted the same question in the T220970 ticket. Let's continue our discussion there.Added By: Michael Bolus at: 5/22/2017 5:32:58 AM    Hi,
I am following the example to the letter.
but, I have an error preventing me from running the application on the 
[XAML]
<local:MyListBoxDragDropManagerx:Name="manager2"/>
and 
[XAML]
<local:MyListBoxDragDropManagerx:Name="manager1"/>
lines. saying {A value of type 'MyListBoxDragDropManager' cannot be added to a collection of disctionary of type 'behaviorCollection'}

can you please help?

 
[XAML]
<Grid><Grid.ColumnDefinitions><ColumnDefinition/><ColumnDefinition/></Grid.ColumnDefinitions><dxe:ListBoxEditx:Name="editor1"DisplayMember="Name"AllowItemHighlighting="True"><dxmvvm:Interaction.Behaviors><local:MyListBoxDragDropManagerx:Name="manager1"/></dxmvvm:Interaction.Behaviors></dxe:ListBoxEdit><dxe:ListBoxEditx:Name="editor2"Grid.Column="1"DisplayMember="Name"AllowItemHighlighting="True"><dxmvvm:Interaction.Behaviors><local:MyListBoxDragDropManagerx:Name="manager2"/></dxmvvm:Interaction.Behaviors></dxe:ListBoxEdit></Grid>



ASPxFileManager - How to show a confirmation dialog to overwrite an existing file

$
0
0

This example illustrates how to show a conformation message to overwrite an existing file in the ASPxFileManager.

The conformation message is shown in the client-side ASPxClientFileManager.FileUploading event and gives an option to the user to either overwrite the existing file or cancel the operation. User's selection is then transferred to the server-side via an ASPxHiddenField. If the user chooses to overwrite the file, the existing file will be deleted.

This example is also available in MVC:
FileManager - How to show a confirmation dialog to overwrite an existing file

Question Comments

Added By: Larry (DevExpress Support) at: 2/19/2015 2:41:06 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T210786: ASPxFileManager does not overwrite an existing file. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

ASPxGridView - How to update total summaries on the client side in Batch Edit mode

$
0
0

This example demonstrates how to update total summaries on the client side when ASPxGridView is in Batch Edit mode. 

You can find detailed steps by clicking below the "Show Implementation Details" link .

See Also:
ASPxGridView - Batch Editing - How to update total summaries on the client side when BatchEditSettings.HighlightDeletedRows = true

ASPxGridView - Batch Edit - How to calculate values on the fly 
ASPxGridView - Batch Edit - How to calculate unbound column and total summary values on the fly 

ASP.NET MVC Example:
GridView - How to update total summaries on the client side in Batch Edit mode

Question Comments

Added By: Dhaval.Shah at: 6/23/2014 5:25:31 PM    

Hi Larry,
Good example for us, I must admit.
I noticed one thing:
I modify C2 value and press TAB, the total updates correctly.
However, when I "cancel changes" the total does not revert to the previous (unchanged) one.
Thought I'd let you know.
Best regards

Added By: Larry (DevExpress Support) at: 6/24/2014 7:52:35 AM    Hi Dhaval,

Thank you for your attention. I have modified the example. Added By: Dhaval.Shah at: 6/24/2014 7:51:38 PM    

Hi Larry,
Thanks for the prompt (as always) update, much appreciated.
It works. However, something's not right it appears:
Please try this.
Run the example, click on first row C2 column, type a number and press TAB.
I ran it in Chrome and the total was not updated (the value in cell reverted to the original value 0).
Then, I went back to the same cell, typed another number and pressed ENTER.
this time it updated correctly.
I must be doing something wrong, but thought I'd run it past you first.
Do update the thread when you can please.
Thanks.

Added By: Larry (DevExpress Support) at: 6/25/2014 3:09:00 AM    Thank you for the clarification. I have created a separate ticket on your behalf to process the issue more effectively:
ASPxGridView - Batch Editing - Some issues with the T114923 example
Please refer to it for further correspondence.              Added By: Alfredo Bergamo at: 11/10/2014 8:48:10 AM    

What happens if you add new rows or delete some of them? How I get the new sum?

Added By: Larry (DevExpress Support) at: 11/11/2014 4:15:19 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T171621: ASPxGridView - T114923 example: How to update total summaries when deleting or adding new rows. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Henry O at: 1/6/2016 11:15:26 AM    

Hello,

This solution works great, however, how do I get the total in the footer to format properly?  Specifically I need currency format.

Added By: Larry (DevExpress Support) at: 1/7/2016 2:57:58 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T331517: T114923 example - How to set the required format for the summay. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: LISSETE GARCES at: 5/20/2016 2:16:14 PM    Running this example I got an error:

Error    43    The type or namespace name 'GridDataItem' could not be found (are you missing a using directive or an assembly reference?)  

and error in the using sentence:

using DevExpress.Web.ASPxEditors;

I have DevExpress  v15.1

Added By: Larry (DevExpress Support) at: 5/22/2016 10:11:05 PM    

Hello,

I've created a separate ticket on your behalf (T382297: ASPxGridView - The "The type or namespace name 'GridDataItem' could not be found" error occurs in the T114923 example). It has been placed in our processing queue and will be answered shortly.

ASPxGridView - Batch Editing - How to update total summaries on the client side when BatchEditSettings.HighlightDeletedRows = true

$
0
0

How to use a hyperlink whose argument depends on several cell values in the ASPxGridView

$
0
0

It is an often situation when a developer should include sever field values in a hyperlink shown in a GridView column cells. The best solution to this problem is to use templates. The attached example shows how this can be done and suggests two similar approaches:

1) in the "simple" case the href parameter of the <a> element is defined by the KeyValue of the processed row
2) in the "complex" case, the href parameter of the <a> element is defined in the server side GetRowValue method.

Update:
If you want to use GridViewDataHyperLinkColumn and preserve its functionality, use unbound columns instead of the DataItem template. Please refer to the ASPxGridView - How to create GridViewDataHyperLinkColumn whose URL depends on several column values example for more information. 

Question Comments

Added By: smoore4 at: 12/17/2013 3:33:38 AM    

This also works. Use a Command Column (eg Custom Button) and code it like this:

        protected void ASPxGridView1_CustomButtonCallback(object sender, DevExpress.Web.ASPxGridView.ASPxGridViewCustomButtonCallbackEventArgs e)
        {

            if (e.ButtonID == "cmdOpenSurveyRpt")
            {

                object[] m_rptvars = (object[])ASPxGridView1.GetRowValues(e.VisibleIndex, "survey_id", "survey_user_id");

                ASPxWebControl.RedirectOnCallback("~/Reports/ReportViewer.aspx" + "?sid=" + m_rptvars[0] + "&uid=" + m_rptvars[1]);

            }

        }


How to export an XtraReport document to DOC, DOCX and ODT file formats

$
0
0

While there is no built-in capability to export documents created by XtraReport to *.doc, *.docx or *.odt file formats, you can accomplish this task by means of the RichEditDocumentServer .

The attached sample illustrates how to add custom bar items to the File Export drop down menu and export a report to these file formats using the RichEditDocumentServer.

Question Comments

Added By: Craig la Buscagne 1 at: 2/22/2013 10:50:04 AM    

Do you perchance have an example of this in VB.NET ?

Thanks

Added By: Anastasius at: 2/25/2013 5:42:00 AM    

If i use the RichEditDocumentServer, i lose all PageHeaders. Because you export it als html (only "one" page header) and import it again.

If i export it as rtf, and import it in your RichEditDocumentServer i lose all formats and text "positions" (Formating).

Any idea how i can export and import the XtraReport an also the nessesary Page headers?

Added By: Amrit Singh 1 at: 10/21/2013 11:45:19 AM    

Hi --

Is there an answer for Anastasius's question because I've just boarded the boat he is in. According to the logic you've mentioned below in your solution, You're first exporting the report to html and then saving it as doc or docx which generates the data correctly but I get only one table for all the sections in a report. I want different headers(tables) so I could later modify(add/delete columns and rows in separate tables in separate sections) them per my needs . That was the whole requirement behind needing a report export to doc and docx. Please suggest a solution and also please let me know when DevExpress is coming up with an integrated export to Doc and export to Docx features? In which release? Because that would eliminate lots of code in my application.

Thanks Much
Amrit Singh

Added By: Fabien GUILLEBERT at: 10/30/2013 8:33:15 AM    

Hello,
This works for ShowPreviewDialog but how the ShowRibbonPreview for RibbonControl in an MDI window?

Thank you for your help.

Added By: Anders Wang at: 8/22/2014 7:22:08 PM    

For simple Report, It is ok. But the problem for report have many tables, after use this way the layout are not acceptable.  We see many persons here posted this kind of request for many years. We all know that doc is MS private format. It is difficult to do that. But for docx, it is open standard and published by ms in 2006, they have open sdk. There're also many opensource ooxml library. Is it possible to implement docx first? Many other reporting tools,eg, fastreport,activereport,txcontrol,aspose,ssrs already have this functionality. Could you please take this into account? Thanks a lot for your great help.

Added By: Ingvar (DevExpress Support) at: 8/25/2014 2:09:14 AM    Hi Anders,

As you know, we are keeping to the WYSIWYG concept, which cannot be properly achieved using OpenXML definition in certain circumstances. We do understand that this is a "must have" export format, but I cannot give you any promises right now.

I want to thank you for your feedback. We greatly appreciate it.Added By: Anders Wang at: 8/29/2014 8:15:21 PM    

Hi,
I think not all the certain circumstances  you said will be a problem for all of users of this product. So, Please just go ahead first. Of course, you are keeping to WYSIWYG concept, But not all of us need it, i also see you said WYSIWYG concept for a long time. But it is not the one what we needed at current and there 're also many places need to be improved before its popular and been accepted. Currently, no any WYSIWYG product can meet my company's requirement for reporting in the market. All of  our complex testing/inspection report is generated by pure code. Because the format is so complex. I see this feature were requested so many years by users here. Why you guys can ignore it year by year. Each time the answer is no immediate plan or estimated time to implement it. We all really appreciate your carefully consideration about the voices of us.

Thanks a lot for your great help.

Added By: Ingvar (DevExpress Support) at: 9/1/2014 6:02:04 AM    Thank you for the explanation, Anders. We will definitely take your feedback into account when planning new features.Added By: Peter Boogaard at: 5/22/2017 10:24:16 AM    We have used this methodology to export our reports to a Word compatible document, using the "doc" extension and the DocumentFormat.Doc as the format. We recently started using Office 365 and when trying to open an exported document the following error would occur in Word:
There is not enough memory or disk space to update the display.

So we switched to use the "docx" extension with OpenXml format. The error in Word will go away. However my report that was in Landscape comes out in Portrait. Also my margins did not seem to be okay. I changed the code as follows:
[C#]
docServer.LoadDocument(temp,DocumentFormat.Html);foreach(varsectionindocServer.Document.Sections){section.Page.Landscape=report.Landscape;section.Margins.Left=report.Margins.Left;section.Margins.Right=report.Margins.Right;section.Margins.Top=report.Margins.Top;section.Margins.Bottom=report.Margins.Bottom;}docServer.SaveDocument(filename,df);

This seems to help but my margins are still not correct. Observing the original values it seems that I need to multiply my report margins by 3. Obviously I don't really want to hardcode that. What would be the correct way of setting the margins? And why are these margins not the same across different DevExpress components?

ASPxGridView - How to create GridViewDataHyperLinkColumn whose URL depends on several column values

$
0
0
This example demonstrates how to create GridViewDataHyperLinkColumn whose URL depends on several column values. Instead of creating a custom DataItemTemplate (How to use a hyperlink whose argument depends on several cell values in the ASPxGridView), you can use Unbound Column.  
Create a column's URL using the GridViewDataColumn.UnboundExpression property:
[ASPx]
<dx:GridViewDataHyperLinkColumnFieldName="HyperLinkColumn"UnboundType="String"UnboundExpression="'Default2.aspx?id='+[CategoryID]+'&name='+[CategoryName]"VisibleIndex="4"><PropertiesHyperLinkEditTextField="CategoryName"DisplayFormatString="Open <b>{0}<b/>"></PropertiesHyperLinkEdit></dx:GridViewDataHyperLinkColumn>
or use the HyperLinkProperties.NavigateUrlFormatString property to add extra text to the complete URL:
[ASPx]
<dx:GridViewDataHyperLinkColumnFieldName="HyperLinkColumn2"UnboundType="String"UnboundExpression="'?id='+[CategoryID]+'&name='+[CategoryName]"VisibleIndex="4"><PropertiesHyperLinkEditTextField="CategoryName"DisplayFormatString="Open <b>{0}<b/>"NavigateUrlFormatString="Default2.aspx{0}"></PropertiesHyperLinkEdit></dx:GridViewDataHyperLinkColumn>

Using this approach, you will be able to preserve the full GridViewDataHyperLinkColumn functionality. 

ASPxHint - How to set custom content

$
0
0

This example demonstrates how to set custom ASPxHint content using the client-side API and server-side markup.


The following scenarios are covered in this example:

 - using a string value to set ASPxHint content; 

 - using a pair of values to set the ASPxHint title and content;

- specifying the title and content elements using the innerHTML property;

- obtaining content from the server side using callbacks.


We recommend using the client-side "onShowing" delegate method to change ASPxHint content in such scenarios.

Also, when content is changed after ASPxHint has been shown, the ASPxHint position may be inconsistent because the content size is changed. Call the ASPxClientHint.UpdatePosition method to correct the ASPxHint position.

ASPxGridView - How to implement cascading comboboxes in Batch Edit mode

$
0
0

In this example, the combo box in the City column (the City combo box) is populated dynamically with city names via callbacks, based on the value selected in the combo box in the Country column (the Country combo box).  
You can find detailed steps by clicking below the "Show Implementation Details" link .

MVC:
GridView - A simple implementation of cascading comboboxes in Batch Edit mode

See also: 
ASPxGridView - How to implement cascading combo boxes in Batch Edit mode by using WebMethods

Question Comments

Added By: umesh patel 1 at: 8/19/2014 11:34:15 PM    

Dear sir
Binding City Editor , if i have more then 400,000 cities need to be bind, Shall i used same binding concept of i used linqservermodedatasource for the binding to increase performance. Can you please send me sample project how can i use linqservermodedatasouce.  
Thanks for your time

Added By: Artem (DevExpress Support) at: 8/20/2014 6:41:34 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T142172: ASPxGridView - How to implement cascading comboboxes bound to a large data in Batch Edit mode . This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: umesh patel 1 at: 8/20/2014 11:01:37 PM    

in CITY edittor inside GridViewDataComboBoxColumn , EditItemTemplate instead of ASPxComboBox i can use aspxlookup becuase i want to provide user to search item based on incremental search

Umesh

Added By: Artem (DevExpress Support) at: 8/20/2014 11:57:38 PM    

Hello,

To avoid discussing multiple topics in this thread, I created a separate ticket on your behalf: T142423: ASPxGridView - Batch Edit - How to use ASPxGridLookup bound to a large database with incremental filtering in EditItemTemplate. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Zoltán Gelencsér at: 6/23/2015 5:23:30 AM    

Dear Support Team,

I've integrated this solution into my project.
It is working well but I have little (huge) problem with it.
If I use Enter key to move cursor from the column to the next column, which is a cascased combobox, and I'm fast and I use 2 times Enter key the combobox value is shown and cleared and the focused column is the next column after combobox.

I've analyzed the code.
The OnBatchEditStartEditing set value of Combobox but the PerformCallback of combobox clears it.
In client side event endcallback I reset it back to the original value. It is working well if I do not leave the combobox column fast.

I hope you have solution for this problem.

Best Regards,

Zoltán

Added By: Artem (DevExpress Support) at: 6/24/2015 1:30:14 AM    

Hello Zoltán,

To process your recent post more efficiently, I created a separate ticket on your behalf: T259299: ASPxGridView - Batch Edit - Issue with cascading comboboxes. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Luca Martini at: 5/23/2017 5:17:27 AM    Hi,
I'm using this approach and it works very well..perhaps the filter inside the combobox (during editing) is not working.
Any suggestion?

Thanks in advance.

How to localize DevExtreme widgets using Globalize 1.X when the AngularJS approach is used

$
0
0

To localize DevExtreme widgets, do the following:


- Link required dictionaries as described in the following help topic:
Link Dictionaries

Note that the order of references is important.


- Reference the DevExtreme localization script:
Use Predefined Dictionaries 

- Initialize your application after setting the locale:

[JavaScript]
$.when(...).then( Globalize.load).then(function(){.. Globalize.locale('de'); angular.bootstrap(document, ['dxApp']);});

Important: Call the angular.bootstrap method only after setting a page locale.


For a more detailed description, refer to the following help topic:


Localization 

See also:
Extend Predefined Dictionaries
Globalize.formatMessage
Unicode-CLDR repository
Localized resources for DevExtreme widgets

How to display progress information about server-side callback processing

$
0
0

Sometimes a server-side operation, which is initiated via a callback request sent by the ASPxCallback control, may take much time (for instance, when a lot of data is obtained and being processed on the server). This example illustrates how you can inform your users about the server-side processing progress.

Note that this approach does not work if the Session state is used. It blocks parallel execution and forces parallel requests to be executed one after another because the access to ASP.NET Session state is exclusive per session.
Refer to the KA18599: How to perform parallel callbacks to get some information about server-side process KB Article for explanation.

See also:
How to display progress information about server-side callback processing (MVC)

How to track progress of server side processing on the client side (using HttpHandler)
How to track progress of server side processing on the client side (using HttpModule)
How to track progress of server side processing on the client side (using WebMethods)
ASPxGridView - How to show a lengthy operation's progress and allow canceling such operations

Question Comments

Added By: David Geers at: 3/22/2013 2:48:15 PM    

The "static double progress" field cannot be used. It is shared by all client running in the browser.

Open the demo in two browsers, say firefox and safari, run the first one, and then while it is running start the second one. The progress in the first windows will be reset to 0%.

This demo is totally useless.

Added By: Ken Tittle at: 4/30/2013 5:10:09 PM    

Yup, this leads people down the wrong path. I'm trying to find an alternative though and can't seem to find it. It would be nice to store it in the Session object, but since EnableSessionState must be disabled, that can't happen. If anybody has an alternative, please let us know.

Added By: Jay Johnson at: 5/18/2015 3:11:40 PM    

Has this been resolved?  Getting an error when I try to run..

Added By: Artem (DevExpress Support) at: 5/19/2015 12:06:39 AM    

Hello Jay,

To process your recent post more efficiently, I created a separate ticket on your behalf: T243718: E918 doesn't work. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Robert Hughes 9 at: 2/22/2016 10:00:09 AM    This should be removed, it simply don't work.Added By: Anthony (DevExpress Support) at: 2/22/2016 11:45:41 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T348686: The "How to display progress information about server-side callback processing" example doesn't work. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to track progress of server side processing on the client side (using HttpHandler)

$
0
0

This example demonstrates one of many possible scenarios when a client should be notified of the progress of a server process. The sample includes a class declaration of a custom HttpHandler; the latter processes the simplest request from the client and returns information that can be restored and used to display current progress, without refreshing the whole page. The other defined class emulates long-time processing, which starts with a standalone thread and is executed in the background. This is an advantage because a callback is performed on the server side quickly if a client requests a new process.

Note that any custom HttpHandler should be registered via the IIS Console Manager or manually through the web.config file. More details are available here: How to register HTTP Handlers.

Please refer to the following links to know more:
Creating an Asynchronous HTTP Handler
Creating a Synchronous HTTP Handler

This example extends the following one: How to display progress information about server-side callback processing.

See also:
How to track progress of server side processing on the client side (using HttpModule)
How to track progress of server side processing on the client side (using WebMethods)
ASPxGridView - How to show a lengthy operation's progress and allow canceling such operations


How to track progress of server side processing on the client side (using HttpModule)

$
0
0

This example demonstrates an alternative way of how to track server-side processing. In this example, a custom HttpModule is used instead of HttpHandler as demonstrated in the How to track progress of server side processing on the client side (using HttpHandler) example. The use of the HttpModule has multiple advantages, and here are some of them:

- The module will be called earlier than the handler;

- At this stage, a user can close the predefined request from the client.
In contrast to the previous example where a session object is used to store a progress value, a simple static class is defined. Note this class has a global scope and should be made thread-safe.

For more information about the difference between the use of HttpModule and HttpHandler, follow this article: HTTP Handlers and HTTP Modules Overview

This example extends the following one: How to display progress information about server-side callback processing

You can find more information on HttpModule basic concepts here: Walkthrough: Creating and Registering a Custom HTTP Module

See Also:
How to track progress of server side processing on the client side (using WebMethods)
ASPxGridView - How to show a lengthy operation's progress and allow canceling such operations

Question Comments

Added By: Les Brinkworth at: 6/21/2013 1:33:41 PM    

Perhaps to help others who are following this example:

The missing piece of the code puzzle is the registration of the HTTPModule in the WEB.Config file:

<configuration>
  <system.webServer>
    <httpModules>
      <add type="CustomModule" name="CustomModule" />
    </httpModules>
  </system.webServer>
</configuration>

Without that this example doesn't work

How to track progress of server side processing on the client side (using WebMethods)

$
0
0

This example demonstrates one of many possible scenarios when a client should be notified of the progress of a server process. Web methods allow you to make a request from the client and return information that can be restored and used to display a current progress, without refreshing the whole page.

The sample demonstrates how to use web methods in two ways:
- Using the jQuery library (the jQuery.aspx page);
- Using ScriptManager (the ScriptManager.aspx page);

Note that web methods should have the [WebMethod] attribute (WebMethod(EnableSession = true) if you use the session). They are defined in the BasePage class that is used by both the jQuery and ScriptManager pages.


To call a web method using jQuery, perform a POST request to the method:

[JavaScript]
WebMethodRequest("jQuery.aspx/StartOperation");...function WebMethodRequest(url, callback){ $.ajax({ url: url, type: "POST", contentType: 'application/json; charset=utf-8', success: callback});}

In case you use ScriptManager, the syntax would be as follows:

[JavaScript]
PageMethods.StartOperation();

Please refer to the following links to know more:
Exposing Web Services to Client Script
How to call WebMethod?

This example extends the following one: How to display progress information about server-side callback processing.

See also:
How to track progress of server side processing on the client side (using HttpModule)
How to track progress of server side processing on the client side (using HttpHandler)
ASPxGridView - How to show a lengthy operation's progress and allow canceling such operations

How to cancel ASPxGridView Callback

$
0
0

This example shows how to cancel ASPxGridView Callback.

For this purpose we added ASPxGridView, the “Update Data Source” button, and ASPxLoadingPanel with the “Cancel” button.

In the beginning, there is no data in ASPxGridView. When an end-user clicks the “Update Data Source” button, data is selected from DB and stored in System.Web.Caching.Cache. We do not use the ASP.NET Session State because it synchronizes requests. For more information, go to ASP.NET Session State Overview Concurrent Requests and Session State. The key value of the Cache is a string variable. It emulates a unique user id. In a real project replace this variable with a unique value of a real user id. After that ASPxGridView is refreshed on the client side and binds to a new datasource.

An end-user can abort the data selecting process by clicking the “Cancel” button. In this case, data is selected from the DB but ASPxGridView will not be refreshed on the client side and will not be bound to the new datasource. ASPxGridView will work with the current datasource. When the data selecting process is finished, ASPxGridView will continue working with new data.

See also:
ASPxGridView - How to show a lengthy operation's progress and allow canceling such operations

ASPxGridView - How to show a lengthy operation's progress and allow canceling such operations

$
0
0

This example is created based on recommendations from the How to display progress information about server-side callback processing example. The main idea is that it is required to divide long-time operations into different steps. Thus, if you know which step is performed, you can display the progress information:

[C#]
intcountOfOperations= 100;for(inti= 0;i<countOfOperations;i++){progressInPercent=Math.Round((double)i/countOfOperations* 100);System.Threading.Thread.Sleep(150);//Do some step here}

 or cancel the processing after finishing of one of these steps:

[C#]
protectedvoidclbCancel_Callback(objectsource,DevExpress.Web.CallbackEventArgse){isCancelRequired=true;}...isCancelRequired=false;intcountOfOperations= 100;for(inti= 0;i<countOfOperations;i++){...if(isCancelRequired)return;}

 

See also:
How to cancel ASPxGridView Callback

How to display progress information about server-side callback processing (MVC)

How to track progress of server side processing on the client side (using HttpHandler)
How to track progress of server side processing on the client side (using HttpModule)
How to track progress of server side processing on the client side (using WebMethods)

How to set a cell color

$
0
0

To specify a cell color, it's necessary to handle the GridView.RowCellStyle event. This example demonstrates how to create a helper class that allows specifying a cell color directly , so you don't need to handle this event yourself.

Question Comments

Added By: Kenneth Holtgrewe at: 5/23/2017 2:03:24 PM    This seems to work well, until you change filter or sort settings in the grid.  Since the RowHandle is not constant, is there a better way to identify the row being processed?
Viewing all 7205 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>