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

OBSOLETE - How to manage users (register a new user, restore a password, etc.) from the logon form in ASP.NET

$
0
0

We'd like to announce that we've published an example demonstrating an alternative and more recommended solution to managing user authentication, registration and related tasks:
How to: Use Google, Facebook and Microsoft accounts in ASP.NET XAF applications (OAuth2 authentication demo)

Instead of creating and maintaining a quite complex custom-tailored implementation for managing users from the logon form, we recommend delegating these routine tasks to OAuth2 providers. For instance, Microsoft or Google provide Office 365 and G Suite services for managing users (e.g., register and delete users, reset forgotten passwords), documents, apps and other things within an organization using standard and familiar for business people means. Your XAF application will just smoothly integrate these OAuth2 providers into the logon form after adding some boilerplate code.

Your feedback on this implementation and the approach in general is welcome.
====================
Scenario

This example contains a reusable Security.Extensions module that provides a possible solution for the following scenarios:

Security - provide the capability to register a new user from the logon form
Security.Authentication - provide a "Forgot Password" feature


Steps to implement

In order to use this module in your project, do the following:

1. Download and include the Security.Extensions module project into your XAF solution (as per MSDN) and rebuild it. This custom module contains Application Model settings (Model.DesignedDiffs.xafml) to layout custom Actions next to the logon form input fields (see the How to: Include an Action to a Detail View Layout  article for more details) as well as non-persistent data models for parameter screens (LogonActionParameters.cs) and finally a ViewController (ManageUsersOnLogonController.cs) for the logon DetailView that declares custom Actions and their behavior. The controller is registered via the XafApplication.CreateCustomLogonWindowControllers event in the ModuleBase descendant (Module.cs) along with other service logic.

2. Invoke the Module Designer for your platform-agnostic module and drag and drop the SecurityExtensionsModule from the Toolbox;

3. Add the following code into your platform-agnostic module class:

[C#]
staticYourPlatformAgnosticModuleName(){SecurityExtensionsModule.CreateSecuritySystemUser=Updater.CreateUser;}

where 'Updater.CreateUser' is your custom method that matches the following definition:

[C#]
publicdelegateIAuthenticationStandardUserCreateSecuritySystemUser(IObjectSpaceobjectSpace,stringuserName,stringemail,stringpassword,boolisAdministrator);

 

IMPORTANT NOTE
This module is currently ASP.NET only.

Question Comments

Added By: Daniele Bonetti at: 8/27/2012 3:14:19 PM    

downloaded and run the demo but i receive "Object reference not set to an instance of an object" error
xaf 12.1.5

Added By: octavia at: 9/24/2012 12:03:14 AM    

It can't be run. Object reference not set to an instance of an object" error

Added By: Santiago Moscoso at: 11/12/2012 3:39:21 PM    

On windows needs to invoke "EnsureShowViewStrategy" method from application, it's protected so you must use reflection.

On web I have problems with the action buttons not refreshing properly, must presh F5 to update buttons. (I'm working on 11.2.11)

Added By: Evgeniy Meyke at: 11/26/2012 4:59:41 AM    

Dennis, any chance to have this checked out soon?

   //Dennis: TODO
            //A possible issue in the framework - Controllers from ShowViewParameters are not added to the current Frame on the Web.
            //e.ShowViewParameters.Controllers.Add(CreateDialogController());

Added By: drew.. at: 3/9/2013 1:16:29 PM    

quick question before i begin integrating this: referring to the comment above " Include the module sources into your solution and rebuild it;" .. are you referring to the modules as listed below, or ALL the xaf modules?

Added By: drew.. at: 3/11/2013 10:12:45 AM    

.. for the benefit of others, this reference to "module" in #1 above, means to drop the entire Security.Extensions folder from the demo into your current solution that you want to update with the basic feature. Then add a reference from your platform-agnostic module (PAM) to the added project, rebuild, THEN go into the module designer for the PAM and drag-n-drop your newly added security module into the required modules section. Then rebuild again.

Added By: drew.. at: 3/11/2013 10:31:40 AM    

btw, i am in the process of integrating this with my DC-only based project. Once i have all the conversions done and tested i will likely post the project to help others save time.

Added By: Mario Blatarić at: 3/12/2013 1:59:10 AM    

Which parts make this module ASP.NET only? I don't understand what needs to be changed in order to make this work in WinForms as well. Any hints?

Added By: John01 at: 4/16/2013 8:10:38 AM    

Hi

When I run the example and click OK on register user I get the error 'Property 'Email' does not exist within type 'DevExpress.ExpressApp.Security.Strategy.SecuritySystemUser'.' on line user.SetMemberValue("Email", email) in function CreateUser. The email value is 'sam@example.com'. I did upgrade the project to 12.2.7 before running though. Any ideas?

Thanks

Regards

Added By: CArlos segura_1 at: 6/13/2013 1:22:53 PM    

someone has been to implement this?

Added By: Tony Tadros Zaky at: 9/5/2013 11:51:37 PM    

Hello Devexpress ,

having problem for some time downloading your examples
was thinking something wrong with my pc but tried some other still the same thing

ICAP Error (icap_error)

  
 An error occurred while performing an ICAP operation: Maximum file size exceeded; File: GetExample; Sub File: ManageUsersOnLogon.Module\BusinessObjects\ReadMe.txt; Vendor: Kaspersky Labs; Engine error code: 0x00000000; Engine version: 8.1.8.79; Pattern version: 130905.225000.10967985; Pattern date: 2013.09.05 22:50:00
 There could be a network problem, the ICAP service may be misconfigured, or the ICAP server may have reported an error.

 For assistance, contact your network support team.

Added By: Apostolis Bekiaris (DevExpress) at: 9/19/2013 3:35:30 AM    

Implemented in eXpandFramework 13.1.7.1
http://apobekiaris.blogspot.gr/2013/09/how-to-manage-users-register-new-user.html

Added By: Daniele M at: 7/26/2015 3:21:28 AM    

I would like to add a capctha code in this registration page.
how can i do? is there an example?
thanks

Added By: Dennis (DevExpress Support) at: 7/27/2015 2:46:05 AM    

@Daniele: While we do not have a ready E4037 example modification for this particular scenario, you can find the following ASP.NET documentation and reference tickets helpful:
ASPxCaptcha Overview
How to Validate a Captcha On Logon Screen
ASPxCaptcha in login page
How to: Use Custom Logon Parameters and Authentication

Should you experience any implementation difficulties, submit a separate ticket and attach your test project showing what you tried to implement according to this information.Added By: Daniele M at: 9/7/2015 7:31:28 AM    

is it possible to customize the logon form in order to obtain the logon button first of two rows with the button "forgot password" and "create a new user"?

Added By: Daniele M at: 9/7/2015 9:04:38 AM    

is it possible to change label to user name in register user form? I tried with displayname attribute in RegisterUserParameters,cs but it didn't work.
thanks

Added By: Dennis (DevExpress Support) at: 9/8/2015 2:43:16 AM    

@Daniele:
Both things are possible. The Security.Extensions module contains the Model.DesignedDiffs.xafml file with model customizations of the AuthenticationStandardLogonParameters_DetailView node. This node determines what your logon form will look like in the UI. You can customize its layout or change captions of items via the Model Editor designer. Should you experience any further customization difficulties here, please submit a separate ticket, and describe what you tried to do and what did not work as expected. Thanks.

Added By: Daniele M at: 9/25/2015 1:12:51 AM    

I can not integrate the example 3 with https://www.devexpress.com/Support/Center/Example/Details/E2849 to enforce password complexity.
can you help me?
thank you

Added By: Anatol (DevExpress Support) at: 9/25/2015 2:23:18 AM    

Hello Daniele,

To process your recent post more efficiently, I created a separate ticket on your behalf: T293660: How to integrate the E4037 and E2849 examples. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: MohammedFarooq at: 10/9/2015 5:33:10 PM    

Hi Dennis & Anatol,

I have used the is example in my project and it works great.

could you please show how to add an image (mylogo.png for example) on the right top corner of the logon page? It is a png image to show company's logo on the logon page.

Added By: Dennis (DevExpress Support) at: 10/12/2015 3:58:10 AM    @MohammedFarooq:
I am happy to hear of your progress.
>> how to add an image (mylogo.png for example) on the right top corner of the logon page?

Would you please submit a separate ticket and attach a screenshot of the desired UI, because possible solutions will vary a lot based on the exact logo placement?

Added By: MohammedFarooq at: 10/12/2015 8:54:03 AM    

Hi Dennis,

I have created a separate ticket as suggested by you.

https://www.devexpress.com/Support/Center/Question/Details/T299424

Added By: Vishwas Mokashi at: 12/24/2015 3:42:16 AM    

Hello,

I want to implement User Registration in our solution.

<<

Steps to implement
In order to use this module in your project, do the following:
1. Include the module sources into your solution and rebuild it;
>>

What are Module Sources ?  Module.cs?  LogonActionParameters.cs?, ManageUsersOnLogonController.cs? given in this ticket?
where and how to include it in solution?

Added By: Dennis (DevExpress Support) at: 12/24/2015 4:50:41 AM    @Vishwas: I have updated this instruction. Let me know in case of any further questions.Added By: Vishwas Mokashi at: 12/24/2015 6:21:21 AM    

Dennis, thanks I know how to include project but where from to down load?. Or I create new Module project and copy paste the code classes given in this ticket?

Added By: Dennis (DevExpress Support) at: 12/24/2015 6:31:24 AM    

@Vishwas: You can download complete example source code under the Downloads section at the right side of the example webpage. Let me know if you experience any further difficulties here.

Added By: Vishwas Mokashi at: 12/24/2015 6:36:55 AM    

Thanks Dennis, I had done that but problem was I did not have the Sample Runner loaded on my machine and could not extract the files.

Thank you and Merry Christmas!!

Added By: Dennis (DevExpress Support) at: 12/24/2015 7:02:23 AM    @Vishwas: Am I correct that you have now installed the Example Runner and could download this example? If so,  I am happy to hear of your results.
Merry Xmas to you and yours too!Added By: Vishwas Mokashi at: 12/24/2015 7:14:39 AM    

Yes Dennis, I have Sample Runner, could download it and use it also. Thanks...

Added By: Dennis (DevExpress Support) at: 12/24/2015 7:33:15 AM    @@Vishwas: Great!Added By: Ryan Elliott_ at: 5/23/2016 12:31:49 PM    where do I find the Security.Extensions module project?Added By: Dennis (DevExpress Support) at: 5/23/2016 12:35:54 PM    @Ryan: See the download link under the Downloads section on the right side of the example's page.Added By: Ryan Elliott_ at: 5/24/2016 7:45:41 AM    @Dennis - Thanks, I got it downloaded and added to our project.  But we don't have a createUser, all of our user accounts will be created by an Admin on a need basis.  is there anyway to use just the Forgot Password functionality?Added By: Dennis (DevExpress Support) at: 5/24/2016 8:00:40 AM    

@Ryan: Thanks for informing me of your results. Sure, you can modify the downloaded project code and remove anything that you do not need from it (e.g. get started with the ManageUsersOnLogonController class). After all, it is just a Controller with custom Actions and related code/XAFML.

Added By: Ryan Elliott_ at: 5/24/2016 8:23:41 AM    @Dennis - I've commented out the RegisterUserAction code in ManageUsersOnLogonController.cs.  My main issue now is with the Module.cs class, and the lines of code below:

static ModuleNameGoesHere()
{
     SecurityExtensionsModule.CreateSecuritySystemUser = Updater.CreateUser;
}

I get an error for "'Updater' does not contain a definition for 'CreateUser'"  Added By: Dennis (DevExpress Support) at: 5/24/2016 8:24:27 AM    @Ryan: These lines are related to the "register new users" functionality and you can comment them out.Added By: Ryan Elliott_ at: 5/24/2016 9:02:03 AM    @Dennis - I've got those lines removed, but now since I've added the SecurityExtensionsModule to the Module.cs of our Module project, I get the below error in Global.asap.cs - WebApplication.Instance.Start();

An exception of type 'DevExpress.ExpressApp.Model.Core.DuplicateModelNodeIdException' occurred in DevExpress.ExpressApp.v15.2.dll but was not handled in user code


Additional information: There is already node with Id 'RestorePassword'. The node: Application/ActionDesign/Actions/RestorePassword.
Added By: Dennis (DevExpress Support) at: 5/25/2016 1:32:32 AM    

@Ryan: This exception indicates that you have included the Controller with RestorePassword Action twice into your application by a mistake. I guess once into YourSolutionName.Module and once as part of the Security.Extensions module. It is correct to include this functionality only once: either as a part of the Security.Extentions module, whose code you are free to modify, or as a part of your own module. So, remove the duplication and everything will go back to normal. If this does not help, please submit a separate ticket via the https://www.devexpress.com/Support/Center/Question/Create service and attach your problematic sample there.

Added By: Ryan Elliott_ at: 5/25/2016 12:05:18 PM    @Dennis - just created this ticket - https://www.devexpress.com/Support/Center/Question/Details/T383948Added By: MohammedFarooq at: 10/29/2016 11:47:20 AM    Hi Dennis,

Just a silly question, Can we show the RestorePassword or RgisterUser buttons as links instead of buttons?

Can ActionUrl object be used in this case? if yes, then can you please guide me on its usage. Added By: Dennis (DevExpress Support) at: 10/31/2016 5:41:17 AM    

@MohammedFarooq: I've created a separate ticket on your behalf (T445256: How to show the RestorePassword or RgisterUser buttons as links instead of buttons (extending E4037)). It has been placed in our processing queue and will be answered shortly.

Added By: Michael (DevExpress Support) at: 7/18/2017 7:46:13 AM    We'd like to announce that we've published an example demonstrating an alternative and more recommended solution to managing user authentication, registration and related tasks:
How to: Use Google, Facebook and Microsoft accounts in ASP.NET XAF applications (OAuth2 authentication demo)

Instead of creating and maintaining a quite complex custom-tailored implementation for managing users from the logon form, we recommend delegating these routine tasks to OAuth2 providers. For instance, Microsoft or Google provide Office 365 and G Suite services for managing users (e.g., register and delete users, reset forgotten passwords), documents, apps and other things within an organization using standard and familiar for business people means. Your XAF application will just smoothly integrate these OAuth2 providers into the logon form after adding some boilerplate code.

Your feedback on this implementation and the approach in general is welcome.

Added By: Michael (DevExpress Support) at: 11/21/2017 8:27:21 AM    We've created an additional example that demonstrates How to add OAuth2 authentication to a WinForms app. Your feedback is welcome.


How to retrieve the last level item data and display it using different ASP.NET controls

$
0
0

This solution can be used with both ASPxDashboardViewer and MVCxDashboardViewer controls:
To request data displayed in the specific Dashboard Item, you should call GetItemData methods of the ASPxClientDashboardViewer object. 
Then, you need to iterate through the item's elements (rows, cells, points, etc ), collect information about corresponding dimensions and measures and store it as JSON collection. You can send this collection to the server in a string format using the JSON.stringify Function. To parse the string on the server, you can use the Json.Decode Method

Note that the Pivot Item returns last level data only for completely expanded rows and columns.
See Also:
T182186: How to get visible data from a certain dashboard item on the client side and process it on the server side
T148767: How to obtain a dashboard item's client data in the Web Viewer

Question Comments

Added By: Dan Palazotto at: 3/31/2018 4:15:50 AM    Can this example be applied to ASPxDashboard Control?

Note:
 Starting with v17.1, we recommend using the ASPxDashboard control or a corresponding ASP.NET MVC extension to display dashboards within web applications. 

ASPxGridView - Simple implementation of an embedded toolbar

How to implement a custom ImageComboBox editor that allows entering custom values

How to access a nested ListView from the parent DetailView's controller and vice versa

$
0
0

This example is based on the following facts:


1. The nested ListView is shown in the parent DetailView via the ListPropertyEditor. The ListPropertyEditor class has the Frame property that returns the nested frame and the ListView property that returns the nested ListView. To get the ListPropertyEditor, use the DetailView.FindItem or DetailView.GetItems method.


2. The nested list view's frame is represented by the NestedFrame class that has the ViewItem property, which returns the ListPropertyEditor from the parent DetailView. It is possible to access the parent DetailView via the ListPropertyEditor's View property.


Note that this code is required only if you need to access views and frames. If you need to access child business objects from the parent DetailView, simply get the DetailView's CurrentObject, cast it to the corresponding type and use its collection property. If you need to access the parent object from the nested ListView, use the PropertyCollectionSource.MasterObject property, as shown in the How to: Access the Master Object from a Nested List View help topic.

Question Comments

Added By: Krzysztof Krzyzsłof at: 7/10/2014 1:10:39 AM    

Works in both WIN and WEB.

How to serialize PivotGridControl descendant's properties with the control's layout

$
0
0

NOTE: This example was created for older XtraPivotGrid versions. The demonstrated solution is appropriate for versions prior to v2011.1.

Generally, to serialize a property of the DevExpress control, it is enough to mark it with the XtraSerializableProperty attribute (see How to serialize a custom property of the DevExpress control's descendant). However, this approach will not work in PivotGridControl since the PivotGridData object, not the PivotGridControl itself, is serialized. So, to accomplish this task, it is required to define the property in PivotGridData, and refer to this property in PivotGridControl. Please see the example's code to see how this should be implemented.

Starting with version 11.1, it is sufficient to decorate properties declared in the PivotGridControl descendant with the XtraSerializableProperty attribute:

[C#]
publicclassMyPivotGrid:PivotGridControl,IXtraSupportDeserializeCollectionItem{privateList<Class1>_Objects=newList<Class1>();[XtraSerializableProperty(XtraSerializationVisibility.Collection,true)]publicList<Class1>Objects{get{return_Objects;}}privateClass1_Object=newClass1();[XtraSerializableProperty(XtraSerializationVisibility.Content)]publicClass1Object{get{return_Object;}}#regionIXtraSupportDeserializeCollectionItemMembersobjectIXtraSupportDeserializeCollectionItem.CreateCollectionItem(stringpropertyName,XtraItemEventArgse){if(propertyName=="Objects"){Class1class1=newClass1();Objects.Add(class1);returnclass1;}elsereturnnull;}voidIXtraSupportDeserializeCollectionItem.SetIndexCollectionItem(stringpropertyName,XtraSetItemIndexEventArgse){}#endregion}

How to use UpCasting in reports to show descendant classes' properties

$
0
0

In the XafApplication, there is the capability to show derived classes' properties in the ListView of the base class using the UpCasting feature. This example demonstrates, how to achieve the same results in XafReport using the BeforePrint script. The BeforePrint handler is called for each record printed in the report. The currently printed record is obtained via the XtraReport.GetCurrentRow method. Then, its type is checked and the text of the report labels is changed according to this type.

The sample report is stored in the *.repx file in the WinExample.Module\EmbeddedReports folder. It is loaded to the database in the UpdateDatabaseAfterUpdateSchema method. For your convenience, I have published the BeforePrint script from this report in a separate file (script.txt). This file is not used by the application.

See Also:
How to: Use UpCasting
Scripting Overview
Distribute the Created Reports with the Application

CategorizedListEditor - How to show subcategory items when a parent category is selected

$
0
0

The CategorizedListEditor consist of two views - the tree list of the categories in the left area of the editor (CategoriesListView), and the list of categorized items on the right (GridView). Items in the GridView are filtered by category, selected in the CategoriesListView. If the selected category has children, items belonging to them won't be shown in the GridView. This example demonstrates, how to change this behavior, and filter GridView to show all items of the selected category and its children. For this purpose, a CategorizedListEditor's descendant - MyCategorizedListEditor - is created. It handles the SelectionChanged event of the ListView of categories and changes the criteria applied to the categorized item ListView to include items related to the nested categories.

See Also:
Implement the ICategorizedItem Interface
Use the Built-in HCategory Class
How to: Implement a Custom Windows Forms List Editor


How to: assign a secondary Y-axis to a series

$
0
0
This example demonstrates how to use a secondary Y-axis to measure a series values.

How to: assign a secondary X-axis to a series

$
0
0
This example demonstrates how to use a secondary X-axis to measure a series values.

How to implement the multi-row editing feature in the GridView

$
0
0

UPDATED:

Starting with version 13.2, the GridView control offers the basic "Batch Editing Mode" functionality that allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET WebForms & MVC: GridView Batch Edit blog post to learn more about this new functionality.
Starting with version 14.1, the GridView control offers advanced "Batch Editing Mode" programming options.

You can find a standalone DB-independent solution in our Code Examples base at:
GridView - A simple Batch Editing implementation

If you have version v14.1+ available, consider using the built-in functionality instead of the approach detailed below.
If you need further assistance with this functionality, please create a new ticket in our Support Center.

This example demonstrates how to implement the multi-row editing feature using the GridView extension. The main idea is to save changed values in the JavaScript dictionary and pass this dictionary to the required action. It is necessary to use a custom ModelBinder in the action to convert passed data to the required dictionary object.

See also:
How to perform GridView instant updating using different editors in the DataItem template
GridView - How to implement batch update using the Ajax request
How to implement the multi-row editing feature in the ASPxGridView
IModelBinder Interface
ASP.NET MVC2 - Custom Model Binder Examples
jQuery.ajax()


Web Forms:
How to implement the multi-row editing feature in the ASPxGridView

Question Comments

Added By: saurabh seth at: 9/11/2013 5:15:50 AM    

i m planning to extend this implementation, is there any way to return back the errors(changes those failed validation) and display the errors (e.g. highlighting the erroneous cell).

Added By: Fabio Vassura at: 1/7/2014 8:15:48 AM    

What about creating ?

How to implement the multi-row editing feature in the ASPxGridView

$
0
0

UPDATED:

Starting with version 13.2, the ASPxGridView control offers the basic "Batch Editing Mode" functionality that allows accomplishing a similar task with less effort and does not require so much extra code. See the ASP.NET WebForms & MVC: GridView Batch Edit blog post to learn more about this new functionality.

Starting with version 14.1, the ASPxGridView control offers advanced "Batch Editing Mode" programming options.

You can find a standalone DB-independent solution in our Code Examples base at:
ASPxGridView - A simple Batch Editing implementation

If you have version v14.1+ available, consider using the built-in functionality instead of the approach detailed below.
If you need further assistance with this functionality, please create a new ticket in our Support Center.

We already have the E158 example showing how to implement a similar feature. The project below is a simplified version of the same functionality, which allows you to edit all rows on a current page at once. To implement this, I added the ASPxTextBox to the DataItemTemplate Container of several columns and bound these editors to the underlying data source. This will force the ASPxGridView to always display editors in these columns. So, the end-user can input values in these editors. After that click the PostModifications button to preserve the changes made. NOTE, this is done without switching the ASPxGridView to the EditMode and back.

To preserve the changes made, I saved editor values to the List<object> and then used these values by setting the UpdateParameters of the ASPxGridView's DataSource. Finally, to obtain editors and their values, I used the ASPxGridView.FindRowCellTemplateControl Method.

See Also:
How to implement the multi-edit functionality with a multi-page grid that is bound dynamically
Custom client-side logic implementation in the grid with multi-row editing
How to edit multiple selected rows in a single Edit Form
How to force the grid to stay in Edit mode
How to perform ASPxGridView instant updating using different editors in the DataItem template

Question:E324 - How to calculate the ASPxGridView group summaries on the client side


MVC:
How to implement the multi-row editing feature in the ASPxGridView

Question Comments

Added By: jdubeau at: 7/17/2012 5:50:48 PM    

this example does update anything.

Added By: Wendy Ramsaur at: 7/23/2012 12:57:07 PM    

How are you collecting updated information and putting it in to the list? This only updates with the original information.

Added By: yaniv abo at: 7/25/2012 11:16:17 AM    

whan you select Run Online the Grid data does not update whan you click "Post Modifications"

Added By: Manish Singh 8 at: 7/30/2012 11:43:03 PM    

@yaniv abo : you have to provide the KeyFieldName Properties of gridview then this code will work

Added By: Wendy Ramsaur at: 7/31/2012 10:34:47 AM    

OK, it works...sort of. I have a column represented by a RadioButtonList. The callback is not getting any updated values. Can I get some help?

Added By: Wendy Ramsaur at: 7/31/2012 10:45:12 AM    

Also just tried using a textbox. Again, does not get updated values in this example.

Added By: Fiona Titcombe at: 10/18/2012 4:00:21 AM    

Is there any solution to this? FindRowCellTemplateControl(grid, col, "txtBox") returns the original value, not the updated value.

Added By: Hamdy Nassar at: 10/20/2012 12:44:48 AM    

thanks alot it is working perfect

Added By: Steve Knowles at: 12/10/2012 10:16:11 AM    

I am having the same problem as others in that the original, not updated value is being returned. Has anyone figured out why this happens in some projects?

Added By: Ashley Perkins at: 12/18/2012 9:02:33 AM    

To anyone having problems with this demo make sure you are not touching the grid view data source on page load.

I was changing the select query and rebinding on page load, this caused the values to reset. Got rid of that and it worked perfectly.

Added By: Bryan Meier at: 1/31/2013 11:36:43 AM    

To add on to what Ashley commented on...

Make sure you have the AutoPostBack set to false on the button you are using to perform the callback. By default the value is true which will override your callback and the OnCustomCallback event of your grid will never get called. Not to mention your changes will be reverted back to the original values.

Added By: Prashanthi G at: 9/3/2013 9:19:25 PM    

In this given example no.of rows is less and it is working fine, how to achieve this kind of functionality if more no of records more say for ex 100 records. page load became very slow and some times not responding message is coming. Any suggessions

Added By: Philippe Foucart at: 9/24/2013 2:18:37 AM    

Works perfect for me on pc, but not on ipad -> on ipad, when clicking the button, nothing happens, I just get the circling image indicating somethings happening in background, but looks like callback is not executed.
any ideas?

Added By: Richard Wilke at: 11/10/2013 3:10:37 PM    

I have converted this code to fit my database structure. It looks like everything is coded correctly, but after running through the code to update the database ...

 for (int i = 0; i < list.Count; i++) {
                AccessDataSource1.UpdateParameters["CategoryName"].DefaultValue = list[i].CategoryName;
                AccessDataSource1.UpdateParameters["Description"].DefaultValue = list[i].Description;
                AccessDataSource1.UpdateParameters["CategoryID"].DefaultValue = list[i].Id.ToString();
// AccessDataSource1.Update(); << Uncomment this line to update data!
            }
            ASPxGridView1.DataBind();

The database never gets updated. Any thoughts? The list gets built correctly and contains all the updated data from the grid. Help.

Added By: M Abo Habiba at: 1/6/2014 1:55:28 AM    

Is this resolved 13.2 as BatchEdit ?

Added By: Paul Astro at: 8/13/2014 12:48:28 PM    

Can we use this Example somehow but within using it within a FORM<>  ???

Added By: Artem (DevExpress Support) at: 8/13/2014 11:17:10 PM    

Hello Paul,

To process your recent post more efficiently, I created a separate ticket on your behalf: T140120: E324 - Using within a form. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

ASPxSpreadsheet - How to add a custom ribbon button and modify an active worksheet on its click

$
0
0
The sample illustrates how to add some values to Spreadsheet cells and clear them when a custom button is clicked.
Steps to implement such a sample are the following:

1. Invoke the ASPxSpreadsheet designer and click the "Create Default Tabs" button. This will lead to creating default ribbon items in your markup

2. Add a custom tab, group and implement your own RibbonTemplateItem with a button. Or add a ribbon item template to the existent group. In the client side event of the button, call the ASPxClientSpreadsheet.PerformCallback method to initiate a server request:
[ASPx]
<dx:ASPxSpreadsheetID="ASPxSpreadsheet1"OnCallback="ASPxSpreadsheet1_Callback"ClientInstanceName="spreadSheet"runat="server"WorkDirectory="~/WorkDirectory"><RibbonTabs><dx:RibbonTabName="Custom"Text="Custom"><Groups><dx:RibbonGroupName="CustomGroup"Text="CustomGroup"><Items><dx:RibbonTemplateItem><Template><dx:ASPxButtonrunat="server"ID="btn1"RenderMode="Link"Text="Send a callback"AutoPostBack="false"><ClientSideEventsClick="function(s,e){ spreadSheet.PerformCallback('custom'); }"/></dx:ASPxButton></Template></dx:RibbonTemplateItem></Items></dx:RibbonGroup></Groups></dx:RibbonTab><dx:SRFileTab><Groups><dx:SRFileCommonGroup><Items><dx:RibbonTemplateItem><Template><dx:ASPxButtonrunat="server"ID="btn2"RenderMode="Link"Text="Clear cells"AutoPostBack="false"><ClientSideEventsClick="function(s,e){ spreadSheet.PerformCallback('clear'); }"/></dx:ASPxButton></Template></dx:RibbonTemplateItem><dx:SRFileNewCommand></dx:SRFileNewCommand> ...</Items></dx:SRFileCommonGroup></Groups></dx:SRFileTab> ....</RibbonTabs></ASPxSpreadsheet>
2. Implement a logic to handle this request in the ASPxSpreadsheet.Callback event handler:
[C#]
protectedvoidASPxSpreadsheet1_Callback(objectsender,DevExpress.Web.CallbackEventArgsBasee){ASPxSpreadsheetss=senderasASPxSpreadsheet;Worksheetworksheet=ss.Document.Worksheets.ActiveWorksheet;if(e.Parameter=="custom"){PrepareTitleRange(worksheet);PrepareHeaderCells(worksheet);InitializeDataCellsValues(worksheet);}if(e.Parameter=="clear"){worksheet.Clear(worksheet.GetUsedRange());}}

ASPXGridView Context menu - How to add a row copy to a specific position

$
0
0

This example demonstrates how to add a row copy to a specific position of ASPxGridView. The FillContextMenuItems event handler is used to add a copy item to the context menu. When a user clicks the copy item, the CreateValuesDictionary method creates a copy of fields of the current row. Then, this copy is used to populate fields of the new row in the InsertNextToGridDataSet method. To keep the order of rows, it is necessary to set up an extra column to store order indexes; and then sort the ASPxGridView by this column.

How to create a movable legend

$
0
0

This example illustrates how to make a chart legend movable, so that an end-user can change its position via drag & drop at runtime.
To accomplish this, the chart's Legend item is rendered to an image and linked to an Image Annotation. The annotation's RuntimeMoving option is enabled to make the annotation element movable.


How to obtain a checked appearance name for each radio button in the radio group

$
0
0
This example shows how to get a checked appearance name for each radio button and check the corresponding radio button with the obtained value.
To accomplish this task, call the GetRadioGroupCheckedAppearanceNames method using a PdfDocumentProcessor instance and the field.

To obtain interactive form data, call the PdfDocumentProcessor.GetFormData method. To check the "Female" radio button, use the PdfFormData.Value property.

How to select detail rows on master row selection

$
0
0

This example shows how to select rows in a detail grid when the master row selection is changed.

Question Comments

Added By: JORGE PALACIOS 1 at: 2/13/2013 8:30:23 AM    

Buenos Dias, estoy haciendo un master detail con pagetab y necesito agregar un tab o page tab dentro de otro tab
cree el primer tab o pagetab y me corre sin problema pero al montar el segund tab me salen errores lo que quierp saber es si puedo colocar un tab dentro de otro o anidar tab dentro de tab

Added By: BOYDAK HOLDING A. S. at: 6/22/2014 2:53:16 AM    

This example does not select all detail rows when i select master row without expendrow. How can i do that?

Added By: Alessandro (DevExpress Support) at: 6/23/2014 3:33:34 AM    

Please try the solution provided in the T121132: Master-Detail ASPxGridView - How to select detail rows on master row selection without expandrow ticket for this purpose. If you have any difficulties with this solution, add a comment to the T121132: Master-Detail ASPxGridView - How to select detail rows on master row selection without expandrow ticket. We will be happy to assist you.

Added By: volqan sam at: 4/6/2018 12:39:08 AM    Hi,
In your example how I can access selected detail rows from different master rows in code behind after post back?

Syntax highlighting for C# and VB code using DevExpress CodeParser and Syntax Highlight tokens

$
0
0

This example demonstrates the use of the ISyntaxHighlightService to display source code of this example in different colors and fonts according to the category of terms. To accomplish this, the text is parsed into tokens according to language syntax elements. The project uses DevExpress parsers for C# and VB, available in the DevExpress.CodeParser library. Resulting tokens are converted into SyntaxHighlightToken objects and format settings for different token types are specified. The DevExpress.XtraRichEdit.API.Native.SubDocument.ApplySyntaxHighlight method applies formatting to document ranges corresponding to the tokens.

See also:
E4139: How to implement T-SQL language syntax highlighting by creating Syntax Highlight Tokens manually- How to implement T-SQL language syntax highlighting by creating Syntax Highlight Tokens manually

ASPxSpreadsheet - How to download a document on custom RibbonItem click

$
0
0

This example illustrates how to download a file on a custom RibbonItem click. The item is added in code behind to the existing ribbon tabs. The tabs are generated by the ASPxSpreadsheet.CreateDefaultRibbonTabs method:

[C#]
Spreadsheet.CreateDefaultRibbonTabs(true);RibbonButtonItemitem=newRibbonButtonItem("Download","Download");Spreadsheet.RibbonTabs[1].Groups[0].Items.Insert(0,item);
[VB.NET]
Spreadsheet.CreateDefaultRibbonTabs(True)Dim item AsNew RibbonButtonItem("Download", "Download") Spreadsheet.RibbonTabs(1).Groups(0).Items.Insert(0, item)

 Since it is not possible to download a document on a callback request (see Why it is impossible to download files on callbacks), a ribbon item should send a postback. For this, use the __doPostBack function in the client-side ASPxClientSpreadsheet.CustomCommandExecuted event handler:

[JavaScript]
function onCustomCommandExecuted(s,e){if(e.commandName == "Download") __doPostBack("DownloadExcel");}

 

ASPxSpreadsheet in this example loads data from a database, so the default file dialogs are disabled: see the Office Document Management > Document Loading article.

How to prevent a DetailView from being shown for a ListView record

$
0
0

Scenario

For certain data forms, a developer needs to limit end-users to editing only through the ListView, i.e. without invoking a separate DetailView.  This is usually done by activating the inline editing and MasterDetailMode = ListViewAndDetailView features as described at eXpressApp Framework > Concepts > UI Construction > Views > List View Edit Modes. More real user scenarios are described in this Support Center thread.


For more convenience and flexibility, the following Model Editor extensions are implemented in the example to control this behavior:
 - The DefaultShowDetailViewFromListView  attribute at the Views node level allows you to control this functionality globally per application via the Model Editor;
 - The ShowDetailView attribute at the Views | ListView node level allows you to customize only certain List Views via the Model Editor;




Steps to implement

1. Copy the WinWebSolution.Module\ShowDetailViewFromListViewController.xx file into the YourSolutionName.Module project and rebuild it.

Note: The process of opening a DetailView by double clicking/pressing the Enter key on a record selected in a ListView is managed by the standard DevExpress.ExpressApp.SystemModule.ListViewProcessCurrentObjectController class and its ProcessCurrentObjectAction in particular. So, we can disable this Action to accomplish our task. The approaches from the eXpressApp Framework > Concepts > Application Model > Extend and Customize the Application Model in Code,  eXpressApp Framework > Concepts > Application Model > Access the Application Model in Code and ActionBase.Enabled Property articles will be used here.

2. For testing purposes, invoke the Model Editor and set the DefaultShowDetailViewFromListView or ShowDetailView properties for the Views or Views | YourObjetType_ListView nodes to False and run the test app to see that a required ListView no longer opens a DetailView in the aforementioned scenario.

Note
We added some optimizations intended to improve the DetailView opening performance. This optimization depends on the default behavior - the ListView item click opens a DetailView. We suggest that you disable this optimization if you suppress DetailView opening to avoid issues. To disable the optimization, add the following code to the App_Start event handler:

[C#]DevExpress.ExpressApp.Web.WebApplication.OptimizationSettings.AllowFastProcessListViewRecordActions = false;

 


IMPORTANT NOTES
This article covers only the case when a DetailView is shown from the ListView after a User double clicks/presses the enter key on a record. Other scenarios should be handled separately by extending the code of this controller. For example, if you do not want to show a DetailView after a new object is created via the New Action, you can handle the NewObjectViewController.ObjectCreating event and set its ObjectCreatingEventArgs.ShowDetailView property to False. However, this is outside the purpose of this article.

Question Comments

Added By: John01 at: 12/2/2015 6:18:00 PM    

This is such as useful feature that it should be part of standard XAF.

Added By: Dennis (DevExpress Support) at: 12/2/2015 11:48:15 PM    Thanks for your feedback. Our team will take it into account (S34026).Added By: Peter Kieslinger at: 12/19/2017 10:15:01 AM    Hi Dennis,

I tried this solution in web without success.
How can this be done in web?

My current Xaf version is 17.2.3
Added By: Michael (DevExpress Support) at: 12/20/2017 6:02:40 AM    @Peter: I just tested the Web part of this example with the current version of our libraries (17.2.4) and can confirm that the solution works as expected. If you have difficulty implementing it in your project, please submit a new ticket and attach the project demonstrating your attempts.

Viewing all 7205 articles
Browse latest View live


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