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

How to specify default parameter values in the Web Viewer

$
0
0
Note: Starting with v17.1, we recommend using the ASPxDashboard control or a corresponding ASP.NET MVC extension to display dashboards within web applications.
To specify initial ASPxDashboard parameter values, use the ASPxDashboard.SetInitialDashboardState event.


Below is the original description related to the ASPxDashboardViewer component.

The following example shows how to specify default parameter values on dashboard loading. To do this, handle the ASPxDashboardViewer.DashboardLoaded event, get access to the dashboard object using the DashboardLoadedWebEventArgs.Dashboard event parameter and specify the default value(s) using the Dashboard.Parameters["parameterName"].Value property.

See also: How to pass a hidden dashboard parameter to a custom SQL query in the Web Viewer

How to implement T-SQL language syntax highlighting by creating Syntax Highlight Tokens

$
0
0

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.

Added By: Martijn Loeffen at: 3/3/2014 8:32:11 AM    

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 PM    

public 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.

Added By: Andrey (DevExpress Support) at: 6/26/2015 5:25:32 AM    

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.

Added By: Stephan Stauber at: 7/29/2015 7:25:58 AM    

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));

Added By: Oleg (DevExpress Support) at: 7/29/2015 7:44:46 AM    

Thank you Stephan for sharing your approach here and especially for posting your regular expression.

Added By: Marc Trudel at: 6/14/2017 3:17:33 PM    Hi
Do you have a newer version of this that supports comments ?

-- and /* */ highlighted in green as in SSMS

Thank you Added By: Ingvar (DevExpress Support) at: 6/15/2017 3:30:19 AM    

Hi Marc,

This example illustrates how to apply syntax highlighting using custom rules (in this case, for basic constructions available in T-SQL). I.e., this example is not intended to fully support all T-SQL constructions, but to demonstrate how to handle different text elements. If you look at the ParseTokens method, you will see that the document is parsed manually in order to locate required parts (string entries and keywords). You can implement a similar search mechanism for comments and add required tokens to the output collection. To sum it up, all you need to do is to locate "comment" ranges using the Document.FindAll method and create SyntaxHighlightTokens for them. If you encounter any difficulties implementing this approach, please create a separate ticket and provide us with a sample project demonstrating the actual result. We will guide you on how to overcome these difficulties.

Added By: Thomas Kafenda at: 4/10/2018 2:57:59 AM    Thanks for the instructions. It works great.
Here is an extended array with T-SQL keywords. Maybe someone will need it:

[C#]
string[]keywords=newstring[]{"ADD","EXTERNAL","PROCEDURE","ALL","FETCH","PUBLIC","ALTER","FILE","RAISERROR","AND","FILLFACTOR","READ","ANY","FOR","READTEXT","AS","FOREIGN","RECONFIGURE","ASC","FREETEXT","REFERENCES","AUTHORIZATION","FREETEXTTABLE","REPLICATION","BACKUP","FROM","RESTORE","BEGIN","FULL","RESTRICT","BETWEEN","FUNCTION","RETURN","BREAK","GOTO","REVERT","BROWSE","GRANT","REVOKE","BULK","GROUP","RIGHT","BY","HAVING","ROLLBACK","CASCADE","HOLDLOCK","ROWCOUNT","CASE","IDENTITY","ROWGUIDCOL","CHECK","IDENTITY_INSERT","RULE","CHECKPOINT","IDENTITYCOL","SAVE","CLOSE","IF","SCHEMA","CLUSTERED","IN","SECURITYAUDIT","COALESCE","INDEX","SELECT","COLLATE","INNER","SEMANTICKEYPHRASETABLE","COLUMN","INSERT","SEMANTICSIMILARITYDETAILSTABLE","COMMIT","INTERSECT, SEMANTICSIMILARITYTABLE","COMPUTE","INTO","SESSION_USER","CONSTRAINT","IS","SET","CONTAINS","JOIN","SETUSER","CONTAINSTABLE","KEY","SHUTDOWN","CONTINUE","KILL","SOME","CONVERT","LEFT","STATISTICS","CREATE","LIKE","SYSTEM_USER","CROSS","LINENO","TABLE","CURRENT","LOAD","TABLESAMPLE","CURRENT_DATE","MERGE","TEXTSIZE","CURRENT_TIME","NATIONAL","THEN","CURRENT_TIMESTAMP","NOCHECK","TO","CURRENT_USER","NONCLUSTERED","TOP","CURSOR","NOT","TRAN","DATABASE","NULL","TRANSACTION","DBCC","NULLIF","TRIGGER","DEALLOCATE","OF","TRUNCATE","DECLARE","OFF","TRY_CONVERT","DEFAULT","OFFSETS","TSEQUAL","DELETE","ON","UNION","DENY","OPEN","UNIQUE","DESC","OPENDATASOURCE","UNPIVOT","DISK","OPENQUERY","UPDATE","DISTINCT","OPENROWSET","UPDATETEXT","DISTRIBUTED","OPENXML","USE","DOUBLE","OPTION","USER","DROP","OR","VALUES","DUMP","ORDER","VARYING","ELSE","OUTER","VIEW","END","OVER","WAITFOR","ERRLVL","PERCENT","WHEN","ESCAPE","PIVOT","WHERE","EXCEPT","PLAN","WHILE","EXEC","PRECISION","WITH","EXECUTE","PRIMARY","WITHIN GROUP","EXISTS","PRINT","WRITETEXT,"+"EXIT","PROC"};



How to create a custom editor allowing you to display a readonly HTML formatted text

$
0
0

This example illustrates how to create a custom editor to display a readonly HTML formatted text. In standalone mode you can use the LabelControl instead.

To show the HTML formatted text in a grid you can assign the RepositoryItemRichTextEdit to an appropriate column. However, the RichEditControl is quite a complex and "heavy" control. So, if you only need to show the HTML formatted text in the grid without editing it the best way to get it done is to assign a custom RepositoryItemHtmlLabel to a column. Note that the HtmlLabelViewInfo implements the IHeightAdaptable interface. So, this custom control supports the word wrapping feature and grid's row auto height feature will work properly.

Question Comments

Added By: Anders Wang at: 9/26/2015 1:06:06 AM    

Hi
How to make the text in the cell can be selected? Thanks.

Added By: Andrew Ser (DevExpress Support) at: 9/28/2015 12:39:31 AM    Hello Anders,
I've extracted your inquiry into a separate thread - How to display selectable HTML text in grid cells. Let's discuss this question there.Added By: Valeria Avramova at: 4/11/2018 6:16:55 AM    I cannot use the LabelControl for this. The documentation says the Label control works for href but not any other text. The comment above saying it supports ReadOnly HTML is misleading.

How to generate groups and items via ItemsSource

$
0
0

This example demonstrates how to bind NavBarControl with a DataSource.

Question Comments

Added By: Mikhail Shubin [DevExpress MVP] at: 4/23/2015 11:04:27 AM    

Hello,

This example has a binding error:
System.Windows.Data Error: 40 : BindingExpression path error: 'Content' property not found on 'object' ''Item'

To fix it I've changed the DataTemplate as follows:
                   <DataTemplate>
                       <TextBlock Text="{Binding Header}" Background="Black" Foreground="Yellow"/>
                   </DataTemplate>

Without it I see black bars instead of items.

Best regards,
Mikhail

Added By: Ilya (DevExpress Support) at: 4/24/2015 6:59:46 AM    Thanks, Mikhail. I have improved the example.Added By: Joseph Fisch at: 4/11/2018 6:55:37 AM    Hi, With this example, how do customize the font settings for the groups and items?

Thank you. Added By: Andrey Marten (DevExpress Support) at: 4/11/2018 7:45:43 AM    


Hello,

I've created a separate ticket on your behalf (T624861: How to change font settings in NavBarGroup and NavBarItems when the approach from E3541 is used). It has been placed in our processing queue and will be answered shortly.

Thanks,
Andrey

How to implement a simple PDF viewer in web ASP.NET WebForms applications by using the Document Server functionality

$
0
0

This example demonstrates how to implement a custom web PDF viewer control by using the DevExpress Document Server functionality.


The main idea of this approach is to use the PdfDocumentProcessor class functionality to load the PDF document and convert its pages to images. Then, these images are rendered in the browser to display PDF document pages.


Important Note:

The Document Server product license is required for using this approach. Please refer to the Subscriptions page for more information.

See also:
How to implement a simple PDF viewer in ASP.NET MVC web application by using the Document Server functionality

Question Comments

Added By: BJ Knudson at: 8/10/2017 2:23:33 PM    Is there a way to implement this with scrolling pages, instead of the page index at the top?Added By: Vasily (DevExpress Support) at: 8/11/2017 4:54:42 AM    

Hi BJ Knudson,

I've created a separate ticket on your behalf for this question: T544849: PDF Viewer - How to display PDF pages whiting a scrollable container instead of using pager. This ticket has been placed in our processing queue and will be answered shortly.

Added By: cedrus bank at: 4/12/2018 12:11:28 AM    Thank you for this great solution. Highly appreciated.

Bilal Harb  

OBSOLETE - How to see and edit the time part in the DatePropertyEditor for the System.DateTime property

$
0
0

==============================
This example is now obsolete. Refer to the How to view and edit only time values without the date part using the WinForms TimeEdit and ASP.NET WebForms ASPxTimeEdit components help topic instead.
==============================

This example demonstrates how to implement a custom PropertyEditor based on the standard one. Here we inherited our editor from the DatePropertyEditor and changed its default behavior to enable Vista style of the editor. This editor will be used for the DateTime property of our business class. We also changed the default display and edit format options to allow entering the time part, not only the date part. To learn more about formatting, please check out MSDN as well as the XtraEditors documentation at:
Formatting.

IMPORTANT NOTE
By default, the CreatedOn property of the DomainObject1 class is formatted using en-US culture settings. So, you might want to modify the EditMask and DisplayFormat to reflect the specifics of your culture.
For instance, you might want to change the hh part in the default mask to HH if your culture formatting settings assume hours to be in a 24-hour format.

See Also:
Built-in Property Editors
Implement Custom Property Editors
How to: Extend Built-in Property Editor's Functionality

How to show ASPxPopupControl on the ASPxGridView's CustomButton click

$
0
0

This example is an illustration of the How to show ASPxPopupControl on the ASPxGridView's CustomButton click KB Article. Refer to the Article for an explanation.

Question Comments

Added By: Gilberto Couto at: 3/6/2015 1:38:51 PM    

I don't know if this is a problem, but I noticed if the gridview have a pagination, the event OnWindowCallback is firing after every page change.

Is that normal?

Added By: Larry (DevExpress Support) at: 3/8/2015 11:22:09 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T216966: ASPxGricView - E4424 example - The OnWindowCallback event is firing after every page change. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Keith Roe at: 4/12/2018 9:06:59 PM    I am attempting to incorporate default1.aspx into my app using 17.2.  When I run it, I get an error "Compiler Error Message: BC30456: 'popup_WindowCallback' is not a member of 'ASP.cardedit_aspx'."  What am I missing?Added By: Lex (DevExpress Support) at: 4/12/2018 11:48:47 PM    

Hello Keith, 

I've created a separate ticket on your behalf (T625534: The "Compiler Error Message: BC30456: 'popup_WindowCallback' is not a member of 'ASP.cardedit_aspx'" error occurs in a certain case). It has been placed in our processing queue and will be answered shortly.

OBSOLETE - How to Use the Current Object Parameter (v9.2.4 - v13.1.12)

$
0
0

This example is now obsolete. See the up-to-date description in the Current Object Parameter help topic.

Question Comments

Added By: Quynh Thai Doan at: 7/12/2013 1:16:18 AM    

I want users can create new user only in his Deparment or childs.. tree. (ITreeNode)
How to solve this issue ?


How to: Use Domain Components in non-XAF Applications (v10.2.3 - v13.1.12)

$
0
0

This example is outdated and only applies to older XAF projects. We do not recommend using Domain Components in new eXpressAppFramework applications.

Detail buttons visibility

$
0
0

This sample shows how to use the TableView.IsDetailButtonVisibleBinding property to selectively hide detail expand buttons. The specified Binding transmits row field values to a value converter. The value converter then specifies if the row containing that value should display the detail expand button.

Question Comments

Added By: Stanislav Snajberg at: 4/13/2018 2:59:18 AM    Hello,
could you publish some example how to achieve this (show expand button only if there's any detail row, otherwise hide expand button at all) with winform XtraGrid.GridControl ?
(I've found this Q471881,T474008  but nothing related to WinForm library)
Thank you,

ASPxGridView - How to display popup using GridViewDataHyperLinkColumn and its NavigateUrlFormatString property

$
0
0

This example contains a Customers grid with a hyperlink column. When a hyperlink is clicked, a popup window is opened to display detail data - orders - of a given customer. Orders is a separate web page, which is embedded into the ASPxPopupControl via the client-side SetContentUrl method.

See Also:
How to show ASPxPopupControl by clicking the ASPxHyperLink in the GridViewDataColumns' DataItemTemplate
How to show detail information in a separate ASPxGridView
How to display master-detail tables in two grids on separate tabs of a PageControl
How to show the ASPxPopupControl
How to display detail data within a popup window using ContentUrl (MVC)
How to display detail data within a popup window (MVC)
E5202: How to display detail data within a popup window using ASPxPopupControl content elements

Question Comments

Added By: Jijo V M at: 7/16/2013 11:10:42 PM    

Hi,
I implemented what you described here. But unfortunately I'm gettingthe following error.
Microsoft JScript runtime error: The value of the property 'ShowDetailPopup' is null or undefined, not a Function object.
DevExpress version 12.2..11.

Added By: Patrik Johansson _ at: 2/4/2018 5:28:15 AM    Yes, this does not even work with the "Run online", gives:

ErrorError occurred during example running. Please try again later.
We apologize for any inconvenience caused. Added By: Lanette (DevExpress Support) at: 2/5/2018 3:09:37 AM    Hello,

Thank you for informing us about the problems with this example executing. We will research the cause of the problem with this example online running and correct this example once we have any results.Added By: Lex (DevExpress Support) at: 2/9/2018 4:54:38 AM    Hello,

We repaired the example. Now it should work fine. Let me know if you find any additional issues.

How to show ASPxPopupControl by clicking ASPxHyperLink in grid column's DataItemTemplate

$
0
0

This demo is based on the How to display detail data within a popup window example. It illustrates how to show the ASPxPopupControl whose ContentUrl property is based on the ASPxGridView.DataRow's field values and Session variables by clicking the ASPxHyperLink control in the GridViewDataColumns's DataItemTemplate.

See Also:
ASPxGridView - How to display popup using GridViewDataHyperLinkColumn and its NavigateUrlFormatString property

Question Comments

Added By: Shawn Collymore at: 6/17/2013 1:24:50 PM    

How do you show ASPxPopupControl by clicking the ASPxGridViewTemplateReplacement Button (using ReplacementType="EditFormUpdateButton")

Added By: Larry (DevExpress Support) at: 10/24/2014 7:08:36 AM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T165226: How do you show ASPxPopupControl by clicking the ASPxGridViewTemplateReplacement Button. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

How to bind the WebChartControl to a data source

$
0
0

This example demonstrates how to bind a web chart to data using series templates.

ASPxGridView - How to make field editors read-only/editable when editing or adding a row

$
0
0

This example demonstrates how to set the editor's ReadOnly property based on the grid's state. That is, it is possible to edit a field value while adding a new row, but this editor becomes ReadOnly on an attempt to edit the existing row.


It is used the ASPxGridView.CellEditorInitialize event to implement this scenario:
Starting with version 14.2:

[C#]
protectedvoidgridView_CellEditorInitialize(objectsender,DevExpress.Web.ASPxGridViewEditorEventArgse){ASPxGridViewgrid=senderasASPxGridView;if(e.Column.FieldName=="CategoryID")e.Editor.ReadOnly=!grid.IsNewRowEditing;}

For older versions:

[C#]
protectedvoidgridView_CellEditorInitialize(objectsender,DevExpress.Web.ASPxGridView.ASPxGridViewEditorEventArgse){ASPxGridViewgrid=senderasASPxGridView;if(e.Column.FieldName=="CategoryID")e.Editor.ReadOnly=!grid.IsNewRowEditing;}

 

Question Comments

Added By: Ju Yeong Jeong at: 1/15/2015 1:00:32 AM    

It's so good example.

Thank you so much !!!

[ASPX]

<dx:ASPxGridView ID="grid" ClientInstanceName="grid" ....
KeyFieldName="MST_CD" OnCellEditorInitialize="grid_CellEditorInitialize">

<dx:ASPxGridView ID="gridDetail" ClientInstanceName="gridDetail" ....
KeyFieldName="MST_CD;CD" OnCellEditorInitialize="grid_CellEditorInitialize">

[C#]
   protected DataTable dtGrid = null;
   protected DataTable dtGridDetail = null;

   protected void Page_Load(object sender, EventArgs e)
   {
       if (! Page.IsPostBack)
       {
               //GET DATATABLE
               dtGrid = dataset.Tables[0];
               //SET PRIMARY KEY(S)
               dtGrid.PrimaryKey = new DataColumn[] { dtGrid.Columns["MST_CD"] };
               //SET SESSION
               Session["DataSet"] = dtGrid;

               dtGridDetail = dataset2.Tables[0];
               dtGridDetail .PrimaryKey = new DataColumn[] { dtGrid.Columns["MST_CD;CD"] };
               Session["DataSetDetail"] = dtGridDetail ;
       }
       else
       {
           dtGrid = (DataTable)Session["DataSet"];
           dtGridDetail = (DataTable)Session["DataSetDetail"];
       }

       grid.DataSource = dtGrid;
       grid.DataBind();

       gridDetail.DataSource = dtGridDetail;
       gridDetail.DataBind();
   }

   /// <summary>
   /// Prevent Editing of the Key Column(s) on Cell Updating
   /// </summary>
   /// <param name="sender"></param>
   /// <param name="e"></param>
   protected void grid_CellEditorInitialize(object sender, ASPxGridViewEditorEventArgs e)
   {
       ASPxGridView oGrid = sender as ASPxGridView;

       string sSession = string.Empty;

       if ("grid" == oGrid.ClientInstanceName )
       {
           sSession = "DataSet";
       }
       else if ("gridDetail" == oGrid.ClientInstanceName)
       {
           sSession = "DataSetDetail";
       }

       DataTable oDt = (DataTable)Session[sSession];
       
       for (int i = 0; i < oDt.PrimaryKey.Length; i++)
       {
           if (e.Column.FieldName == oDt.PrimaryKey[i].ColumnName)
           {
               e.Editor.ReadOnly = !oGrid.IsNewRowEditing;
               return;
           }
       }
   }

Added By: Quasar Wong at: 5/3/2015 9:00:10 PM    

Hi! I am using Batch Edit mode but CellEditorInitialize event will not fired when clicking New button, any other method can do this scenario else? Thanks!

Added By: Larry (DevExpress Support) at: 5/3/2015 10:55:45 PM    

Hello,

To process your recent post more efficiently, I created a separate ticket on your behalf: T237217: ASPxGridView - Batch Editing - The CellEditorInitialize event will not fired when clicking New button. This ticket is currently in our processing queue. Our team will address it as soon as we have any updates.

Added By: Ravi Anand 1 at: 6/1/2016 12:34:16 AM    Hi, i have applied given example in ASP.NET MVC, folllwing is my gridview settings sample partial code:

[C#]
settings.CellEditorInitialize=(s,e)=>{ASPxGridViewgrid=sasASPxGridView;ASPxEditeditor=(ASPxEdit)e.Editor;if(e.Column.FieldName=="columnName1"||e.Column.FieldName=="columnName2"){e.Editor.ReadOnly=!grid.IsNewRowEditing;}};

now i can't edit while updating existing row data, that seems perfect.

but i can't edit both columns while creating new row using new button. please help me out here. Thank you in advance. Added By: Stason (DevExpress Support) at: 6/1/2016 6:04:51 AM    

Hello Ravi, 

Since your last post is related to ASP.NET MVC, I've created a separate ticket on your behalf (T386483: GridView - How to apply an approach from the E5116 example to edit columns when a new row is being created). It has been placed in our processing queue and will be answered shortly.

Added By: william sutphin 1 at: 7/5/2017 6:52:06 AM    How do you hide the whole column?Added By: Larry (DevExpress Support) at: 7/6/2017 4:52:15 AM    

Hello,

I've created a separate ticket on your behalf (T533092: ASPxGridView - How to hide some field editors when editing a row and allow their editing when adding a new row). It has been placed in our processing queue and will be answered shortly.

How to: Use the XPO OData V3 Service

$
0
0

To start the service, run the ODataService project. To start the client application, run the ODataV3Example project.

See Also:
How to implement CRUD operations using XtraGrid and OData
How to implement CRUD operations using XtraGrid and WCF Server Mode
GridControl - How to use the WcfServerModeSource component as a data source
How to process authenticated requests on the OData service
How to send authenticated requests to the OData service


IMPORTANT NOTES
1. An OData service created using the OData Service Wizard is a standard WCF Data Service 5+ for OData v3. We don't provide documentation on how to consume this service because this task has no XPO-related specifics. Use standard solutions recommended for OData services in public community resources like MSDN and StackOverFlow. For instance, you may find these resources helpful:
    WCF Data Services Client Library
    Updating the Data Service (WCF Data Services) and How to: Add, Modify, and Delete Entities (WCF Data Services) 
    DataServiceContext.SaveChanges and DataServiceContext
2. Composite keys are not currently supported by XpoDataServiceV3 and it is unlikely that they will be supported in the near future. You may receive the "The entity type 'XXX' does not have any key properties. Please make sure that one or more key properties are defined for this entity type." error with OData Service (XpoDataServiceV3) if you map your persistent class to a table or view with a multi-column key. Since the XAF Mobile UI uses XPO OData Service, this will not work there as well.  In general, we do not recommend using composite keys as they impose many limitations on the default functionality. Refer to the How to create a persistent object for a database table with a compound key article for more details.
3. A WCF Data Service supports custom service methods (Service Operations and Actions) as standard features. Please refer to the corresponding MSDN articles to learn how to implement and use these features in your service: Service OperationsService Actions.
4. With the 17.1 release, non-persistent property values can be loaded using the XPO OData Service. To enable this functionality, apply the Visible attribute to a non-persistent property. Our XPO Odata Service will automatically execute your custom business logic associated with this property and return the resulting value to the client.
5. Custom non-persistent types cannot used by the XpoDataServiceV3, which is designed to operate persistent types only. So, for this task, I suggest you continue using a regular non-XPO service. Refer to the Q577141 article for possible solutions.
6. XpoDataServiceV3 provides partial support for annotations. The static XpoDataServiceV3.CreateAnnotationsBuilder method expects a delegate to obtain XpoContext and returns a delegate that adds string fields sizes and read-only flags descriptions to the annotation. You can put this delegate to the service configuration to get these annotations.

public class XpoTestService : XpoDataServiceV3 {
 public static void InitializeService(DataServiceConfiguration config) {
   ...
   config.AnnotationsBuilder = CreateAnnotationsBuilder(MyGetXpoContextDelegate);
 }
}

If you need to include additional information in annotations, wrap this delegate with your own extended delegate.
7. Properties of the System.Drawing.Image and byte[] types are mapped to the DataServiceStreamLink type in a service reference (Edm.Stream). To get data from this DataServiceStreamLink, use the DataServiceContext.GetReadStream method. Then load an image from the returned Stream. Here is an example from the article's ClientForm.cs file:

DataServiceStreamResponse resp = context.GetReadStream(context.Categories.Where(i => i.CategoryID == categoryID).Single(), "StreamPicture", new DataServiceRequestArgs());
pictureBox.Image = Image.FromStream(resp.Stream);

To use byte arrays instead of DataServiceStreamLink in your service, override the XpoContext.ShowLargePropertyAsNamedStream method and returning False in it. Refer to the Working with Binary Data (WCF Data Services) article for more details.


How to hide filter buttons in column headers

$
0
0

If you wish to filter data against columns, using only the built-in Filter Editor, you can hide the filter button within the column header by simply changing the dxgt:GridColumnHeaderThemeKey ResourceKey=FilterAreaStyle.
This example illustrates this approach in action.

Question Comments

Added By: Michael Zaytsev at: 1/10/2013 5:18:49 AM    

This not works if I use DXWindow and some theme, e.g. <dx:DXWindow dx:ThemeManager.ThemeName="MetropolisLight" ...>...</DxWindow>.

Added By: Adam Caviness at: 4/19/2018 7:10:42 AM    How does this solution differ from using AllowColumnFiltering="False"? Did TableView.AllowColumnFiltering not exist at the time this example was made?

ASPxMenu - How to bind a control to a database

$
0
0

This sample shows how to bind the ASPxMenu to data stored in a database.

Question Comments

Added By: Iso9001 at: 5/21/2013 12:44:50 AM    

protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BuildMenu(ASPxMenu1);
                BuildMenu(ASPxMenu3);
            }
        }

        protected void BuildMenu(ASPxMenu menu)
        {
            String sql = "select * from menus where Menu_Level = 0 and Menu_Status = 1";
            cMenus oMenus = new cMenus();
            DataSet ds = oMenus.GetRecordsToDs(sql);
            Int32 menu_id;
            foreach (DataRow row in ds.Tables[0].Rows)
            {
                menu_id = Convert.ToInt32(row["Menu_Id"]);
                DevExpress.Web.ASPxMenu.MenuItem item = menu.RootItem.Items.Add();
                item.Name = Convert.ToString(row["Menu_Name"]);
                item.Text = Convert.ToString(row["Menu_Name"]);
                DataSet iDs = GetGroupItems(menu_id);
                for (int i = 0; i < iDs.Tables[0].Rows.Count; i++)
                {
                    DevExpress.Web.ASPxMenu.MenuItem ChildItem = new DevExpress.Web.ASPxMenu.MenuItem();
                    ChildItem.Name = iDs.Tables[0].Rows[i]["Menu_Name"].ToString();
                    ChildItem.Text = iDs.Tables[0].Rows[i]["Menu_Name"].ToString();
                    ChildItem.NavigateUrl = iDs.Tables[0].Rows[i]["Menu_SeoUrl"].ToString();
                    item.Items.Add(ChildItem);
                }
            }
        }

        private DataSet GetGroupItems(Int32 menu_id)
        {
            cMenus oMenus = new cMenus();
            String sql = "select * from menus where Menu_Level = 1 and Menu_Sub = " + menu_id + " order by Menu_Sort";
            DataSet ds = oMenus.GetRecordsToDs(sql);
            return ds;
        }

        public DataSet GetRecordsToDs(String sqlStr)
        {
            IDbConnection Conn = (IDbConnection)new SqlConnection(ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString);
            Conn.Open();
            IDbCommand dbCommand = new SqlCommand();
            dbCommand.CommandText = sqlStr;
            dbCommand.Connection = Conn;
            IDbDataAdapter dataAdapter = (IDbDataAdapter)new SqlDataAdapter();
            dataAdapter.SelectCommand = dbCommand;
            DataSet ds = new DataSet();
            dataAdapter.Fill(ds);
            Conn.Close();
            return ds;
        }

Added By: Nic Carreira at: 10/23/2013 10:40:20 AM    

I had a question on this.
Could someone explain how the child items are getting added to the menu?

For the root items menu.Items.Add(item) makes sense to me.

I understand menuItems.Add(itemID, item) does this somehow but how does that method know which menu to add the items too?

Thanks
Nic

Added By: Anthony (DevExpress Support) at: 10/24/2013 4:02:07 AM    

Hello Nic,

The menuItems dictionary contains MenuItem objects. Since root items are already added to the menu control, and the subitem added to the root item (that we obtain from the dictionary by key) automatically becomes a part of the whole hierarchy.

Added By: Nic Carreira at: 10/24/2013 10:21:53 AM    

Ok, this makes sense now.

Thanks

Added By: Dale Jensen Lodge at: 5/10/2016 11:53:59 PM    Hi it would be good to get sight of the underlying table that this code is referencing so we can see exactly what it's looking at. Thanks
Added By: Artem (DevExpress Support) at: 5/11/2016 12:34:13 AM    

Hi Dale,

I see you asked this question in the https://www.devexpress.com/Support/Center/Example/Details/E49 thread. Please refer to it for further correspondence.

Added By: Keith Roe at: 4/19/2018 7:15:14 PM    The Support Center item above does not let you in unless it is your ticket.

How to enable the multi-selection mode in LookUpEdit

$
0
0

LookUpEdit natively supports the multi-selection mode. To enable it, set the editor's StyleSettings property to an appropriate object (such as TokenLookUpEditStyleSettings) - see Editor Operation Modes > LookUpEdit for more information.

If you wish to select records on a click basis (without the CTRL modifier) or customize the drop-down grid in any other way, use the PopupContentTemplate property.

For more information on how to achieve the same in the previous DevExpress versions, refer to the Implementation Details section.

Question Comments

Added By: Adel Ayyam at: 1/6/2014 2:50:47 PM    

Hi Devexpress,
The example is not working as expected when IsTextEditable="True", when searching by some text and selecting corresponding items the selecteditems is always empty ???

Best regards,
Ayyam

Added By: Alex Chuev (DevExpress Support) at: 1/7/2014 4:28:02 AM    

Hi Ayyam,

I've created a separate ticket regarding this issue: http://www.devexpress.com/Support/Center/Question/Details/Q465097. We will process your inquiry there.

Thanks,
Alex

Added By: Stefan N at: 2/7/2014 5:46:08 AM    

This does not work or I do not complete understand it. How do I get the selected items out of it? Can I use the SelectedItem property with a binding? I've tried it but only one item is set, not a list of items if I select more than one.

Added By: Alex Chuev (DevExpress Support) at: 2/7/2014 7:01:14 AM    

Hi Stefan,

I suggest that you use the LookUpEdit.EditValue property to get or set selected items.

Thanks,
Alex

Added By: Stefan N at: 2/7/2014 8:06:11 AM    

Thanks Alex. It works with the EditValue property.

Maybe you can help me with one additional problem in this context:
I add a delete button to the LookUpEdit.Buttons property. I am not sure, what I should do in the event handler to delete the selection. Currently I am setting the EditValue to Null, which updates the bounded datasource correctly. But when I reopen the editor, the items are still selected.

Added By: Andrey Marten (DevExpress Support) at: 10/31/2014 6:29:24 AM    
Hello Stefan,

We accidentally discovered that your initial post was out of scope of our Support Center for a long time. Please accept our sincere apologies for not responding in a timely manner.


I've created a separate ticket on your behalf regarding the task you've mentioned in your message to process it more efficiently: LookUpEdit - Selected items are not cleared when EditValue is set to Null  

If this task is still important for you, please find a couple of minutes to refer to that thread.


Thanks,
Andrey

How to create a custom action type with a custom control (BarCheckItem), associated with it

$
0
0

This example demonstrates how to represent an action via the BarCheckItem. For this purpose, an ActionBase descendant (CheckableSimpleAction) is implemented. This is done because it is required to save the checked state of the action. CheckableSimpleAction uses a custom action item (CheckActionItem), which represents it in the UI via a BarCheckItem. Action item is a connector between the abstract entity Action and a particular UI element. When the form's menu is created, XAF creates action items for all actions placed to this form via action containers. This operation is performed by the BarActionItemsFactory and the ActionControlsSiteController. Since we have implemented a custom action type, it is required to implement a custom BarActionItemsFactory to assign an appropriate action item to actions of this type. The custom BarActionItemsFactory is registered via the custom factory provider (MyBarActionItemsFactoryProvider).
Note that in most cases, it is not required to implement a custom action and action item. It is sufficient to customize the existing action item via the BarActionItemsFactory.CustomizeActionControl event. This approach is demonstrated in the How to: Customize Controls Associated with an Action topic.
An example for ASP.NET is available here: How to create a custom action type with a custom control in Web

Question Comments

Added By: Alex Miller at: 6/19/2016 9:15:31 AM    Is this still the same in 16.x? It seems BarActionItemsFactoryProvider.CreateBarActionItemsFactory() is never run.Added By: Alexey (DevExpress Support) at: 6/20/2016 3:18:58 AM    

Hello,

I've created a separate ticket on your behalf (T394010: E1977 with version 16.1). It has been placed in our processing queue and will be answered shortly.

Added By: Casey Chester 2 at: 4/20/2018 3:36:14 PM    I have the same problem as reported by Alex Miller above but I am using 17.2. The ticket T394010 created for this incident seems to be marked private - I cannot view it. Please advise.

How to use Scheduler with DateNavigator

$
0
0
This example follows the How to: Create the Scheduler with the DateNavigator topic and demonstrates how to create a scheduling application with the DateNavigator control to enable end-users selecting date ranges for display.

Question Comments

Added By: JRelyea at: 4/22/2018 7:46:16 PM    I'm using 17.2.4 and this sample does not download & run. There are compile errors. I made sure I pulled the right project version. 

The solution says these are invalid objects:
CustomizeSpecialDatesEventArgs
CustomizeSpecialDates
MaxSelectedConsecutiveWeeks
MaxSelectedNonConsecutiveDates Added By: JRelyea at: 4/22/2018 7:48:34 PM    I found the problem: Selecting 17.2.3-17.2.5 in the version drop down does not change what gets downloaded; only the web page gets updated.


Is that normal?
Viewing all 7205 articles
Browse latest View live


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