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

How to process authenticated requests on the OData service

$
0
0

This example demonstrates how to process authenticated requests on the OData service. The main idea is to override the DataService.OnStartProcessingRequest method and implement authenticated logic in it.

To access this service, use the following credentials:

UserName: John
Password: qwerty

See also:
OData and Authentication – Part 6 – Custom Basic Authentication
Salt (cryptography)
How to send authenticated requests to the OData service
How to: Use the XPO OData V3 Service

Question Comments

Added By: Jay Patel 15 at: 9/24/2013 11:33:27 AM    

I was wondering why this project is not compatible with Visual Studios Ultimate 2010? Thanks

Added By: Joseph Tang 3 at: 10/10/2013 7:57:30 AM    

I used your code with the modification that it would check the AD for authentication. It works. However, it always popup the login window for entering the username and password.

Added By: Pedro Coutinho 1 at: 11/28/2013 3:22:33 AM    

How can i get the userinfo from the database?

Added By: Pedro Coutinho 1 at: 11/29/2013 7:09:31 AM    

How can i retrieve this users from a database?

Added By: George Yoder at: 1/25/2014 1:19:44 PM    

How would you do authentication with sql membership provider????

Added By: Enderson Salas at: 7/29/2014 4:26:35 PM    

This example no compile in  Visual Studio 2013  because some assembly references are missing.

Added By: Nikolai (DevExpress Support) at: 7/30/2014 4:23:50 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T135174: E4403 is not compiled in Visual Studio 2013. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: PedroPerez at: 7/1/2015 7:56:29 AM    

Hello Dev express team,

Can you please explain me how to get my the user information from our DB, we use  The Profile provider in ASP.NET Membership & Users, and how to integrated to this Authentication process?

************************* YOUR SAMPLE CODE************************
namespace MyDataService {     
public class CustomBasicAuth {          
class UserInfo {             
public string Name { get; set; }             
public string PasswordHash { get; set; }             
public string[] Roles { get; set; }         }          
static UserInfo[]
Users = new[] {             new UserInfo {                 
Name = "John",                 
PasswordHash = "F3U89ry4+MMXyqbbT90tcs18J5Y=",                 
Roles = new[] { "User", "Admin" }             }         };
************************************************************************
My Tables:

aspnet_Users:
UserID
UserName

aspnet_Membership:
UserID
Password (encripted)

aspnet_Roles:
RoleID
RoleDescripcion

aspnet_UsersInRoles:
UserID
RoleID

Regards
Pedro Perez


How to programmatically add a PDF Viewer control at runtime

How to bind a report displayed in the DocumentViewer extension to the model's data

$
0
0

This example demonstrates how you can bind a Report in your ASP.NET MVC application to your model class.


Note:

Starting with version 14.2 (2014 vol 2), use the ObjectDataSource component to bind your report to your Model class schema as demonstrated in the How to: Bind a Report to an Object Data Source help topic.

In earlier versions, to populate the XtraReport Field List window with your model properties, add the BindingSource component to your report, as shown in the Providing Data to a Web Report help topic.

Question Comments

Added By: Mark Melton 1 at: 1/13/2014 1:46:11 PM    

What I completely DO NOT understand, which therefore leaves me perplexed right this moment is: HOW DID YOU BIND THE REPORT TO THAT "POCO" CLASS IN DESIGN MODE? This is what I am dying to know!

Added By: Vasily (DevExpress Support) at: 1/13/2014 11:51:46 PM    

Hi Mark,

It seems that the same task was discussed in the Q562556: Is there a way to bind a report to a custom model class at design time thread. Please refer to it.

Added By: Prayagraj Dedaniya at: 4/19/2015 11:51:35 PM    

Hi,

In this Example I think You have not Given the Definition of the class "CategoriesReport" used in the Home Controller "DocumentViewerPartialExport" Action method.  So It is bit Difficult for me to understand. So I am requesting you to please Give me Code for the defination of the "CategoriesReport" class ASAP.

Added By: Dmitry Tok (DevExpress Support) at: 4/20/2015 1:19:29 AM    Hello,

Please download this Code Example and open it in Visual Studio. You'll find the definition of the CategoriesReport class in the Reports folder of the project. I've also changed the structure of this Code Example, so that the corresponding source code files are now available for preview.
Thanks

How to display a non-persistent object's Detail View from the Navigation

$
0
0

The complete description is available in the How to: Display a Non-Persistent Object's Detail View from the Navigation help topic.


Question Comments

Added By: DKx at: 7/1/2015 7:27:56 AM    

This code fails with session-based non-persistent classes when Refresh action is called:

"The error occurred:
Type:       SessionMixingException
Message:    The 'Example.Module.MyNonPersistentObject' object belongs to a different session."

void application_CustomProcessShortcut(object sender, CustomProcessShortcutEventArgs e)
{
   if (e.Shortcut.ViewId == "MyNonPersistentObject_DetailView")
   {
       IObjectSpace objectSpace = Application.CreateObjectSpace();
       e.View = Application.CreateDetailView(objectSpace, objectSpace.CreateObject<MyNonPersistentObject>(), true);
       e.Handled = true;
   }
}

How to solve it?

Added By: Dennis (DevExpress Support) at: 7/1/2015 11:26:44 AM    @DKx: It is wrong to inherit non-persistent classes from the base XPO classes like BaseObject, XPObject, etc. Use session-less POCOs instead (like demonstrated in this example).

How to create a Scatter Radar Line chart

$
0
0
The following example demonstrates how to create a Scatter Radar Line chart at runtime.

Note that this series view type is associated with the Radar Diagram type, and you should cast your diagram object to this type, in order to access its specific options.
Question Comments

Added By: José Luis Terán at: 7/1/2015 3:09:25 PM    

Run Online is not working. The page doesn't exist

How to access API of underlying controls in the WinForms Viewer

$
0
0

The following example demonstrates how to customize controls used to visualize data within dashboard items at runtime using DashboardViewer's API. This approach is described in greater detail in the Access to Underlying Controls help topic.
In this example, the following options are changed:
- The font of data rows' text is changed in the underlying grid control in the DashboardItemControlUpdated event handler.
- The background color of the chart's pane is changed in the DashboardItemControlUpdated event handler.
- Values of data cells in the underlying pivot grid control are customized using the CustomCellValue event. Subscription and unsubscription to/from the CustomCellValue event are performed in the DashboardItemControlCreated and DashboardItemBeforeControlDisposed event handlers respectively.

How to access API of underlying widgets in the Web Viewer

$
0
0

This example demonstrates how to customize client widgets used to visualize data within dashboard items at runtime using ASPxClientDashboardViewer's API. This approach is described in greater detail in the Access to Underlying Widgets help topic. 
The following options are changed:
- Highlighting of the hovered grid row is enabled in the underlying dxDataGrid in the ItemWidgetCreated event handler.
- A standard tooltip that is invoked when an end-user hovers over a chart series point is disabled. You can invoke a tooltip by clicking the required label on the argument axis. The argumentAxisClick event is used for this purpose. Subscription and unsubscription to/from the argumentAxisClick event are performed in the ItemWidgetCreated and ItemBeforeWidgetDisposed event handlers respectively.
- A pie legend is shown for the underlying dxPieChart.

How to export the GridDashboardItem item data to Excel from a web solution

$
0
0

In this example, you will find how to implement server-side export of the GridDashboardItem data from an ASP.NET solution using the report suite. The export is performed in three steps:
1. We request data displayed in a specific dashboard item using a client-side script provided in the T182186: How to get visible data from a certain dashboard item on the client side and process it on the server side example and send this data to the server in the form of a JSON string.
2. The JSON string is parsed on the server side. Based on the retrieved data, we generate a report containing a simple table.
3. Finally, it is necessary to export the report to an Excel document and write this document to the response. It is possible to use the same approach to export the resultant report to other file types. 


How to emulate the dxLookup behavior using the dxPopup, dxList and dxCheckBox widgets

$
0
0

At present the dxLookup does not support templates. So, the only way to customize it (e.g., implement multiple selection or show several columns) is to emulate its behavior using other widgets.

Question Comments

Added By: FredrikE at: 10/8/2013 4:17:06 AM    

The dxList seem to loose its scrolling functionality when using it in a dxPopup. Try extending the list of OS:es in the sample like this:
        os: new ArrayStore([
            { name: 'Win3_1' },
            { name: 'Win95' },
            { name: 'WinMe' },
            { name: 'Win98' },
            { name: 'Win200' },
            { name: 'WinNT' },
            { name: 'WinXP' },
            { name: 'Vista' },
        ])

Added By: Marion (DevExpress Support) at: 10/8/2013 5:27:13 AM    

@Fredrik,

It seems that this behavior is related to the issue that we are going to fix in the context of the following thread:
http://www.devexpress.com/Support/Center/Question/Details/Q524866

Added By: Aster Alessandro at: 7/2/2015 3:38:19 AM    

You can have a project with angular?

How to filter a LookUpEdit by multiple columns

$
0
0

The easiest way to search by multiple columns in LookUpEdit is to use the SearchLookUpEditStyleSettings class as demonstrated in the How to: Create a SearchLookUpEdit and Bind it to Data article.

If you would like to filter by multiple columns when a user types directly in the edit box instead, create a LookUpEditStrategy descendant and override the UpdateDisplayFilter method where the filter criteria is set.

Question Comments

Added By: John Kerin at: 1/14/2015 11:53:57 AM    

Hi, I have downloaded the example for 14.2.3 and it fails to run as it throws an exception:
Unable to cast object of type 'EditorsDataProxy2' to type 'EditorsDataProxy1'.

However, if I run it using earlier versions it runs with no problem.  

Can you let me know a workaround, as I have just upgraded our project from 14.1.4 to 14.2.3 and this use case is blocking me.

Regards,
JK

Added By: Elliot (DevExpress Support) at: 1/15/2015 2:54:33 AM    Hello,


To process your recent post more efficiently, this issue will be processed in the Example to filter a LookUpEdit by multiple columns not working in 14.2.3 ticket. 


Thanks,
Elliot

How to implement a master-detail report using Subreports (XRSubreport) without parameter bindings

$
0
0
This example demonstrates how to implement a master-detail report using Subreports without parameter bindings but through the BeforePrint event of the XRSubreport.
Please refer to the How to implement a master-detail report using Subreports (XRSubreport) without parameter bindings KB article for implementation details.

NOTE: The subreport parameter bindings feature introduced in version 15.1 enables you to implement this without writing any code. For more information, see How to: Create a Master-Detail Report using Subreports.

How to sort field values in server mode using the CustomServerModeSort event

$
0
0
This example demonstrates how to implement a custom sorting algorithm by handling the CustomServerModeSort event. The "Month" field is sorted using the cross area key, and the "Category" field is sorted directly.

How to remove standard bar items and add custom ones to the DocumentViewer toolbar

How to remove standard bar items and add custom ones to the DocumentPreviewControl toolbar

$
0
0

This example demonstrates how to customize the DocumentViewerControl's toolbar (either BarManager or RibbonControl).

In particular, it shows how to remove standard commands from it and add custom ones.

How to update a document displayed by the ASPxDocumentViewer within the ASPxPopupControl

$
0
0

This example illustrates how to update a web report's content on the fly by placing the ASPxDocumentViewer within the ASPxPopupControl and calling the ASPxClientDocumentViewer.Refresh method.

An additional hidden field is provided on the web page to pass parameter values to a report before its document is set forth and published using the ASPxDocumentViewer.

Question Comments

Added By: Nasser Alazemi at: 7/2/2015 10:09:32 PM    

This example not working

Added By: Dmitry Tok (DevExpress Support) at: 7/3/2015 2:42:21 AM    

Hello Nasser,

I have just tried to run this example online (here is a direct link) and download a sample project to my machine. In both cases, the sample project from this Code Example operates correctly. It would be great if you register a new ticket in our Support Center and describe what error you are facing with the sample project from this Code Example.

Thanks,
Dmitry


How to sort the pivot grid's data by OLAP member properties

How to load a PDF document from the Stream

$
0
0
This example shows how to load a document from the Stream using the DocumentViewerControl.DocumentSource property.

GridView - Batch Editing - A simple implementation of an EditItem template

$
0
0

This example demonstrates how to create a custom editor inside column's DataItem template when GridView is in Batch Edit mode.

You can implement the EditItem template for a column by performing the following steps:

1. Specify column's EditItem template:

[C#]
       settings.Columns.Add(column=>       {           column.FieldName="C1";           column.SetEditItemTemplateContent(c=>           {               @Html.DevExpress().SpinEdit(spinSettings=>               {                   spinSettings.Name="C1spinEdit";                   spinSettings.Width=System.Web.UI.WebControls.Unit.Percentage(100);                   spinSettings.Properties.ClientSideEvents.KeyDown="C1spinEdit_KeyDown";                   spinSettings.Properties.ClientSideEvents.LostFocus="C1spinEdit_LostFocus";               }).Render();           });       });


2. Handle grid's client-side BatchEditStartEditing event to set the grid's cell values to the editor. It is possible to get the focused cell value using the e.rowValues property:

[JScript]
       function Grid_BatchEditStartEditing(s, e){           var productNameColumn = s.GetColumnByField("C1");           if(!e.rowValues.hasOwnProperty(productNameColumn.index))               return;           var cellInfo = e.rowValues[productNameColumn.index];            C1spinEdit.SetValue(cellInfo.value);           if(e.focusedColumn === productNameColumn)                C1spinEdit.SetFocus();       }


3. Handle the BatchEditEndEditing event to pass the value entered in the editor to the grid's cell:

[JScript]
function Grid_BatchEditEndEditing(s, e){var productNameColumn = s.GetColumnByField("C1");if(!e.rowValues.hasOwnProperty(productNameColumn.index))return;var cellInfo = e.rowValues[productNameColumn.index]; cellInfo.value = C1spinEdit.GetValue(); cellInfo.text = C1spinEdit.GetText(); C1spinEdit.SetValue(null);}

 

4. The BatchEditRowValidating event allows validating the grid's cell based on the entered value:

[JScript]
function Grid_BatchEditRowValidating(s, e){var productNameColumn = s.GetColumnByField("C1");var cellValidationInfo = e.validationInfo[productNameColumn.index];if(!cellValidationInfo)return;var value = cellValidationInfo.value;if(!ASPxClientUtils.IsExists(value) || ASPxClientUtils.Trim(value) === ""){ cellValidationInfo.isValid = false; cellValidationInfo.errorText = "C1 is required";}}

 
5. Finally, handle the editor's client-side KeyDown and LostFocus events to emulate the behavior of standard grid editors when an end-user uses a keyboard or mouse:

[JScript]
var preventEndEditOnLostFocus = false;function C1spinEdit_KeyDown(s, e){var keyCode = ASPxClientUtils.GetKeyCode(e.htmlEvent);if(keyCode !== 9 && keyCode !== 13)return;var moveActionName = e.htmlEvent.shiftKey ? "MoveFocusBackward" : "MoveFocusForward";if(grid.batchEditApi[moveActionName]()){ ASPxClientUtils.PreventEventAndBubble(e.htmlEvent); preventEndEditOnLostFocus = true;}}function C1spinEdit_LostFocus(s, e){if(!preventEndEditOnLostFocus) grid.batchEditApi.EndEdit(); preventEndEditOnLostFocus = false;}

 
 
See Also:
ASPxGridView - Batch Editing - A simple implementation of an EditItem template 
GridView - Batch Editing - A simple implementation of an EditItemTemplate with client-side unobtrusive validation

Question Comments

Added By: Abdullah Garcia at: 5/14/2015 7:36:56 AM    

Is there any example that uses GridLookup instead of a SpinEdit?

Added By: Mike (DevExpress Support) at: 5/15/2015 12:57:34 AM    

I see you've created a separate ticket with this subject. We'll reply to you there. Please bear with us.

How to load a PDF document from a Uri

$
0
0
This example shows how to load a document in the PDF Viewer from a Uri using the DocumentViewerControl.DocumentSource property.

BreadCrumbEdit - How to disable showing editor's drop down window

$
0
0
This example illustrates how to disable showing BreadCrumbEdit's drop down form window
Viewing all 7205 articles
Browse latest View live