How to use DXDocking in Web Browser-Inspired Apps
How to load a PDF document from a file
How to modify the PopupContainerEdit reaction on the outer mouse click
By default, the RepositoryItemPopupContainerEdit.CloseOnOuterMouseClick property allows you to specify that the PopupContainerEdit should not close the pop-up window if the user clicks within another pop-up window opened by the control placed within the pop-up Form. However, there is no way to keep the pop-up window if the user clicks within the PopupContainerEdit owner Form. This example demonstrates how to create the editor inherited from the PopupContainerEdit that does not close its pop-up Form, unless the drop-down button or Escape keyboard key is pressed.
To implement this functionality, it is necessary to create a custom PopupContainerForm descendant, and override its AlllowMouseClick method. You can put any complex logic within this method to calculate whether or not the pop-up window should be closed in a certain situation. This example simply returns the True value in, any case.
See also:
How to register a custom editor for use in the XtraGrid
Question Comments
Added By: Martin Bauer 1 at: 9/7/2012 3:07:40 AM
it doesnt help if the user does a click outside of the application. in this case the QueryResult comes to early. the bigest limitation is now you cant show modal dialogs(OpenFileDialog) from a custompopup. Sad!
Added By: Kevin Gabbert 1 at: 6/5/2015 4:38:57 PMCustomPopupContainerEdit does not implement ISupportInitialize, so this can't be used as a control on a form. Nor can its popup position be set. This makes this solution useless.
Added By: Uriah (DevExpress Support) at: 6/8/2015 12:37:52 AMHello Kevin,
To process your recent post more efficiently, I created a separate ticket on your behalf: T252281: Feedback for E3586. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
Hello.
I encountered the similar problem with my custom popup editor. When the user clicks outside the editor but inside the vertical grid owning this editor, it closes saving EditValue in the cell, as neccessary. But in the case of mouse click outside the grid my popup editor disappears leaving the cell value unchanged. I tried to call the grid's CloseEditor() method from various lost focus handlers, but it gave no result.
Please help me, how to force my popup editor to save changes in any case of closing up, except Esc pressed?
How to implement custom binary storage configuration
This example demonstrates how to implement different storage strategies for the DevExpress control's binary images.
The FileCacheStrategy scenario implies the use of a specific folder on the server for storing the ASPxGauge's binary images. Changing the control's value causes generating its new image, which is stored into a specified folder. Cache is cleared every 10 minutes. Each image can be obtained by using its recourse key.
The StaticImageStrategy scenario implements storing the ASPxGridView binary data (a specific column with binary images) into a public folder within an application. Each image within the folder has its own static URL. In this scenario, cache is cleared every 60 minutes.
See Also:
Binary Storage Configuration
Question Comments
Added By: NIKOLAY SONIN at: 7/25/2015 2:08:06 AM
Hi,
I'm trying to use DevExpress in Sharepoint 2013 and would like to know how and where to place a call to BinaryStorageConfigurator.RegisterCustomStorageStrategy()? Obviously, I have no access to Global.asax in SP.
How to make an editor show NullText even if it has focus
By default NullText disappears when an editor gets focus. To change this behavior, you can create VisualBrush containing the NullText string and apply it to the editor's Background.
Question Comments
Added By: Mehran Balaei at: 1/3/2013 11:25:59 AM
I have same problem with Winform controls (XtraEditors.TextEdit).
How can I make TextEdit show NullText even if it has focus?
If I don't put this style inline i.e. defined inside the control then only this solution works. If I put this style and resource in ResourceDictionary, this solution doesn't work. Wonder why?
How to manage users (register a new user, restore a password, etc.) from the logon form in ASP.NET
Scenario
This example contains a reusable Security.Extensions module that provides a solution for the following suggestions:
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. Include the module sources into your solution and rebuild it;
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
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 PMOn 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 AMDennis, 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());
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 AMbtw, 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 AMWhich 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 AMHi
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 PMsomeone has been to implement this?
Added By: Tony Tadros at: 9/5/2013 11:51:37 PMHello 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 AMImplemented in eXpandFramework 13.1.7.1
http://apobekiaris.blogspot.gr/2013/09/how-to-manage-users-register-new-user.html
I would like to add a capctha code in this registration page.
how can i do? is there an example?
thanks
How to split field value cells
The following example demonstrates how to split field value cells.
In this example, the Grand Total column header is split into two cells: Price and Count. To do this, the CustomFieldValueCells event is handled, and the event parameter's Split method is used. Cells that should be split are identified by a predicate that returns true for those cells. The quantity, size and captions of newly created cells are specified by an array of cell definitions (the FieldValueSplitData objects).
How to delete ASPxCardView selected cards
ASPxGridView - How to specify the CommandButtons’ and Custom CommandButtons’ properties based on any custom criteria
The example demonstrates how to specify the CommandButtons and Custom CommandButtons properties by handling the CommandButtonInitialize and CustomButtonInitialize events. The DataRows' VisibleIndex property and criteria set based on field values are used to determine the buttons' visibility.
Question Comments
Added By: Hans Leonhardt at: 11/16/2013 9:27:49 AM
Just as an addition:
If you're Using an Entity e.g. an EntityDatasource this fails. This will work, e.g.
Private Function DeleteButtonVisibleCriteria(ByVal grid As ASPxGridView, ByVal visibleIndex As Integer) As Boolean
Dim row As NameOfYOurEntity = ASPxGridView1.GetRow(visibleIndex)
' e.g: The Entity has a boolean Property named "isAdmin"
Return row.isAdmin
End Function
Is there a way to find out if a row is the first or last row in a Grid ? I need to hide a button based on that criteria ?
Added By: Alessandro (DevExpress Support) at: 11/17/2014 7:47:58 AM Hi,I will create a separate ticket on your behalf to keep this web page simple: ASPxGridView - E3028 - Check row location. Thank you for your time and cooperation in advance.
Added By: Annette V at: 7/27/2015 1:45:16 AMHello,
it's a pity, that your examples modified in 2014 is not running in VS 2013, because the example produces the message "The 'Microsoft.Jet.OLEDB.4.0' provider is not registered on the local machine".
I don't want to change my system for that problem.
Hello Annette,
To process your recent post more efficiently, I created a separate ticket on your behalf: T271600: How to use AccessDataSource / Microsoft.Jet.OLEDB.4.0 with VS 2013. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
How to implement the cascading ComboBoxes feature starting with v15.1
How to save custom settings to a dashboard XML definition and apply these settings in the Dashboard Viewer
The following example shows how to save custom settings to a dashboard XML definition in the Dashboard Designer and apply these settings in the Dashboard Viewer.
This example contains four projects - the Dashboard Designer and three types of the Dashboard Viewer: WinForms, Web and MVC. In the Designer, you can change the font size of chart legend items. The DashboardItemControlUpdated event is used to access the underlying Chart control in the Dashboard Designer and change the font size of legend items. The Dashboard.UserData property provides the capability to save this value to the dashboard XML definition. Finally, dashboard definitions included in Dashboard Viewer projects are updated using the Dashboard.SaveToXml method.
In Dashboard Viewer projects, special members are used to access underlying controls and apply the custom font size:
- In the WinForms DashboardViewer, the DashboardItemControlUpdated event is used to access the underlying chart control.
- In the Web/MVC Viewer, the ItemWidgetCreated event is used to access the underlying dxChart widget. The CustomJSProperties event is handled to send custom data from the server to the client.
Note that changing specific control/widget settings may lead to various issues. To learn more, see the following topics:
- Access to Underlying Controls
- Access to Underlying Widgets
How to provide ASPxReportDesigner with the SqlDataSource, ObjectDataSource and EFDataSource at runtime
GridView - Batch Edit - How to use the upload control in Batch Edit mode
1) Place UploadControl into the column's EditItem template:
[C#]c.SetEditItemTemplateContent(container=>{Html.DevExpress().UploadControl(ucSettings=>{ucSettings.Name="uc";ucSettings.CallbackRouteValues=new{Controller="Home",Action="UploadControlUploadFile"};ucSettings.UploadMode=UploadControlUploadMode.Advanced;ucSettings.Width=Unit.Percentage(100);ucSettings.ClientSideEvents.TextChanged="OnTextChanged";ucSettings.ClientSideEvents.FileUploadComplete="OnFileUploadComplete";}).Render();});
2) Handle the grid's client-side BatchEditStartEditing event to set the grid's cell values to the upload control. It is possible to get the focused cell value using the e.rowValues property:
[JScript]function OnBatchStartEditing(s, e){ browseClicked = false; $("#hf").val(e.visibleIndex);var fileNameColumn = s.GetColumnByField("FileName");if(!e.rowValues.hasOwnProperty(fileNameColumn.index))return;var cellInfo = e.rowValues[fileNameColumn.index]; setTimeout(function(){ SetUCText(cellInfo.value);}, 0);}
3) Handle the grid's client-side BatchEditConfirmShowing event to prevent data loss on the upload control's callbacks:
This "browseClicked" flag is set to true when the upload control starts uploading a file and to false when the file has been uploaded or the user starts editing another cell.[JScript]function OnBatchConfirm(s, e){ e.cancel = browseClicked;}
4) Handle the upload control's client-side TextChanged and FileUploadComplete events to automatically upload the selected file and update the cell value after:
[JScript]function OnFileUploadComplete(s, e){ gridView.batchEditApi.SetCellValue($("#hf").val(), "FileName", e.callbackData); gridView.batchEditApi.EndEdit();}function OnTextChanged(s, e){if(s.GetText()){ browseClicked = true; s.Upload();}}
5) Handle the upload control's FileUploadComplete event to store the uploaded file in the session:
[C#]publicActionResultUploadControlUploadFile(){varvisibleIndex=Convert.ToInt32(Request.Params["hf"]);UploadControlExtension.GetUploadedFiles("uc",null,(s,e)=>{varname=e.UploadedFile.FileName;e.CallbackData=name;if(Helper.Files.ContainsKey(visibleIndex))Helper.Files[visibleIndex]=e.UploadedFile.FileBytes;elseHelper.Files.Add(visibleIndex,e.UploadedFile.FileBytes);});returnnull;}
Now you can access all the uploaded files in the Batch action method. Clear the session storage after you have updated the files.
See also:
T191652: ASPxGridView - Batch Edit - How to use the upload control in Batch Edit mode
Question Comments
Added By: Hrushikesh Phapale at: 7/27/2015 8:59:39 AM
hi,
I have tried the same bu getting error "DevExpress.Web.ASPxUploadControl is a type not a namespace" in home controller.
I have update the project to 15.1.3 version and I am using Visual studio 2013.
I also tried to find the reference of DevExpress.Web.ASPxUploadControl in my local machine but could not found any related assembly to it.
Really wondering what to do.
Please suggest any solution to it.
ASPxCardView - How to change the visibility of check boxes in multi-selection mode
Scheduler - Lesson 1 - Show appointments in read-only mode
This example demonstrates how to show appointments in a simple scheduling application using MVC Scheduling Extensions bound to data. We suggest that you review it if you are a first-time user of the ASP .NET MVC Scheduler.
Note that the scheduler is in read-only mode to make the code easier to understand.
This project is created by following the step-by-step guide of the Lesson 1 - Use Scheduler to Display Appointments in Read-Only Mode.
To learn how to implement the appointment editing functionality, review step-by-step guide in the Lesson 2 - Implement Insert-Update-Delete Appointment Functionality and see the result in the E3984: Scheduler - Lesson 2 - Insert-Update-Delete appointment feature example.
The SchedulerExtension.Bind method overload allows to hide specific appointments and resources. In this example it is used to hide appointments with "Test" in their subject lines and resources containing "TEST" in their captions. Note that the final data binding, i.e. a call to the SchedulerExtension.Bind(object appointmentDataObject, object resourceDataObject) should be placed after the call to the Bind method overload which filters appointments.
Question Comments
Added By: Luke Grews at: 5/24/2012 11:52:44 AM
Great work DX!
Can't wait for the release, this looking good!
Any chance of a BETA soon to test our MVC Scheduler?
Regards
Added By: Aakash Bashyal Bashyal at: 7/28/2015 5:34:52 AMI did not got my Appointment Displayed!! Please help .
Added By: George (DevExpress Support) at: 7/28/2015 6:20:09 AMHello,
To process your recent post more efficiently, I created a separate ticket on your behalf: T272195: Appointments doesn't displayed. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.
How to implement the "Insert Document Field" dialog (WinForms version)
This example demonstrates how to implement a custom "Insert Document Field" dialog to insert fields with corresponding formatting attributes into RichEditControl documents.
All fields are inserted into a current document position using the SubDocument.Fields.Create method. The key point here is that you need to obtain a corresponding sub-document which is related to the caret position, since the caret can be located in the main document, its header or footer.
To obtain a corresponding sub-document, the DocumentPosition.BeginUpdateDocument method is used.
Also, this example demonstrates how to insert expressions and results of the "IF" field calculation as nested document fields (there is a corresponding option near the "left expression", "right expression", "true result" and "false result" of the "IF" field attributes).
To built the solution demonstrated in this sample into an existing application, copy all modules and the "insertFieldIcon.png" image located in the InsertFieldModules folder and use a corresponding RegisterInsertFieldDialogCommand extension method to add the "Insert Field" command onto a current Ribbon control:
CS
[C#]richEditControl1.RegisterInsertFieldDialogCommand(ribbonPageGroup1,null);
VB
[VB.NET]richEditControl1.RegisterInsertFieldDialogCommand(ribbonPageGroup1, Nothing)
How to dynamically size a image to make it fit into the entire page client area
How to: Hide the 'Protected Content' Rows in List Views
The complete description is available in the How to: Hide the 'Protected Content' Rows in List Views topic.
Question Comments
Added By: John A. Fuqua at: 7/28/2015 9:16:17 PM
Does this filter/hide by role or user/owner?
How to implement T-SQL language syntax highlighting by creating Syntax Highlight Tokens manually
This example illustrates how to implement simplified syntax highlighting for the T-SQL language by registering the ISyntaxHighlightService. Note that we do not use the DevExpress.CodeParser library in this example. Text is parsed into tokens (a list of SyntaxHighlightToken Class instances) manually in the CustomSyntaxHighlightService.ParseTokens() method. The resulting list is sorted (see Documentation - It is not mentioned that a list passed to the SubDocument.ApplySyntaxHighlight method should be sorted) and passed to the SubDocument.ApplySyntaxHighlight Method.
See Also:
Syntax highlighting for C# and VB code using DevExpress CodeParser and Syntax Highlight tokens - Syntax highlighting for C# and VB code using DevExpress CodeParser and Syntax Highlight tokens
Question Comments
Added By: Roland Radlmair at: 6/6/2013 1:35:59 AM
Hi,
could you also add the functionality for highlighting comments like "// this is a comment".
That would be great!
Thanks.
This example throws an exception when running with DevExpress 2013.1.9 and 2013.2.7. A workaround is to replace the order of the folowing lines:
richEditControl1.ReplaceService<ISyntaxHighlightService>(new CustomSyntaxHighlightService(richEditControl1.Document));
richEditControl1.LoadDocument("CarsXtraScheduling.sql");
There still remains an issue, because another document cannot be loaded: it still throws an exception.
Added By: Anders Wang at: 6/25/2015 8:47:48 PMpublic void Execute() {
document.ApplySyntaxHighlight(ParseTokens());
}
Hi,
it is not so correct way to call ParseTokens() each time when need ApplySyntaxHighlight. You can try it with increase the keywords array to above 200-500. The tokens should be initialized when the docment loaded. After then, it should be updated incrementally and should not be build each time.
Hello,
I have discussed this behavior with our developers and we have come to the conclusion that this behavior is by design.
For now, we are not planning to change it in the near future.
Instead of
// search for quotation marks
ranges = document.FindAll("'", SearchOptions.None);
for (int i = 0; i < ranges.Length / 2; i++) {
tokens.Add(new SyntaxHighlightToken(ranges[i * 2].Start.ToInt(),
ranges[i * 2 + 1].Start.ToInt() - ranges[i * 2].Start.ToInt() + 1, stringSettings));
it's better to use a Regex, especially if you want to highlight "double quoted strings" as well as 'single quoted strings'. We tried to search first for all single quotes and then for double quotes. not a good idea.
We had many errors, when a quotation was not ended (open quote exists without end quote) inside another quote (i.e. "this's a quote, "where "single 'quote' is not closed")
...
stringRegex = new Regex(@"((""(.|/[[:blank:]]/)*?"")|('(.|/[[:blank:]]/)*?'))"); //original pattern: (("(.|/[[:blank:]]/)*?")|('(.|/[[:blank:]]/)*?'))
...
// search for quoted strings
ranges = document.FindAll(stringRegex);
foreach (var range in ranges)
tokens.Add(new SyntaxHighlightToken(range.Start.ToInt(), range.Length, stringSettings));
Thank you Stephan for sharing your approach here and especially for posting your regular expression.
How to prevent a DetailView from being shown when a User double clicks or presses the Enter key on a record in a ListView
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.
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.