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

dxDataGrid - How to fix column headers related to page scrolling

$
0
0
Question Comments

Added By: Geoffroy Bruch at: 11/4/2016 12:41:22 AM    Hi,


Your example show the header column is fixed at top effectively but he does'nt work (sort order for example ..). I try in my context with .dx-datagrid-header-panel class & clone(true) (with data & events) for more precision.


And the result is degraded ..


Can you test with ".dx-datagrid-header-panel" for see the result (short precision: i use a custom dxButton in addition in traditionnal button of the grid)..and why not solve the problem ?


Thank you for your help..


Best regards. 
Added By: Larry (DevExpress Support) at: 11/4/2016 3:03:27 AM    

Hello,

I've created a separate ticket on your behalf (T446910: dxDataGrid - How to fix column headers related to page scrolling with enabled sorting). It has been placed in our processing queue and will be answered shortly.


How to get a list of higher level field values corresponding to the specific Field Value or Cell and use them in custom templates

$
0
0

This example demonstrates how to get a list of the parent Field Value corresponding to a specific Field Value or Cell.

See Also:
Q254783: FieldValueTemplate - Generate of URL string by clicking cell from the set of parameters located in different Fields Values

Question Comments

Added By: Anand Kumar A at: 11/6/2016 10:56:48 AM    

 

HI Team,

  it is fetching data from higher level of row area but I need to get all values of row area

Ex:-

     I need  company name –Alfreds Futterkiste|OrderDate-1995|ProductName-Aniseed Syrup.

In my scenario I need to display the count I was clicking  on Grid in another page.

I required all row area to get correct count of record.

 

Added By: John (DevExpress Support) at: 11/6/2016 9:02:14 PM    

Hello Anand,

It seems that you have already asked this question in our support center: PivotGrid hyperlink to get all level row area values with header. Let's continue our discussion there.

ASPxSpreadsheet - How to add a chart to a document

$
0
0

This example demonstrates how to add the following charts to a document:
- pie chart;
- bar chart;
- column chart;
- complex chart;
- doughnut chart;
- pie 3d chart;
- scatter chart;
- stock chart;
- bubble chart.

All the available chart types are listed at ChartType

See also: Creating and Modifying a Chart Programmatically

How to create a custom BarItem

$
0
0

BarItem is not a visual element and creating its descendant may be not sufficient if it's necessary to customize its behavior. BarItem is represented in a visual tree by BarItemLinkControl. To use a custom BarItemLinkControl, register it using the BarItemLinkControlCreator.RegisterObject method. 

How to implement CRUD operations when WcfInstantFeedbackDataSource or WcfServerModeDataSource is used

$
0
0

This example shows how to use WcfInstantFeedbackDataSource or WcfServerModeDataSource with DXGrid, and how to implement CRUD operations (e.g., add, remove, edit) in your application via special behavior.
The test sample requires the SQL Express service to be installed on your machine.

We have created the WCFServerModeCRUDBehavior and WCFInstantModeCRUDBehavior attached behaviors for GridControl. For instance:

[XAML]
<dxg:GridControl><i:Interaction.Behaviors><crud:WCFServerModeCRUDBehavior...><crud:WCFServerModeCRUDBehavior.DataSource/><dxsm:LinqServerModeDataSource.../></crud:WCFServerModeCRUDBehavior.DataSource></crud:WCFServerModeCRUDBehavior></i:Interaction.Behaviors></dxg:GridControl>

 

The WCFServerModeCRUDBehavior and WCFInstantModeCRUDBehavior classes contain the NewRowForm and EditRowForm properties to provide the "Add Row" and "Edit Row" actions. With these properties, you can create the Add and Edit forms according to your requirements:

[XML]
<DataTemplatex:Key="EditRecordTemplate">    <StackPanelMargin="8"MinWidth="200">        <Grid>            <Grid.ColumnDefinitions>                <ColumnDefinition/>                <ColumnDefinition/>            </Grid.ColumnDefinitions>            <Grid.RowDefinitions>                <RowDefinition/>                <RowDefinition/>            </Grid.RowDefinitions>            <TextBlockText="ID:"VerticalAlignment="Center"Grid.Row="0"Grid.Column="0"Margin="0,0,6,4"/>            <dxe:TextEditx:Name="txtID"Grid.Row="0"Grid.Column="1"EditValue="{Binding Path=Id, Mode=TwoWay}"Margin="0,0,0,4"/>            <TextBlockText="Name:"VerticalAlignment="Center"Grid.Row="1"Grid.Column="0"Margin="0,0,6,4"/>            <dxe:TextEditx:Name="txtCompany"Grid.Row="1"Grid.Column="1"EditValue="{Binding Path=Name, Mode=TwoWay}"Margin="0,0,0,4"/>        </Grid>    </StackPanel></DataTemplate><crud:WCFServerModeCRUDBehaviorNewRowForm="{StaticResource ResourceKey=EditRecordTemplate}"EditRowForm="{StaticResource ResourceKey=EditRecordTemplate}"/>

This Behavior classes require the following information from your data model:
- EntityObjectType - the type of rows;
- DataServiceContext - an object of the DataServiceContext type;
- PropertiesList - the table columns' list;
- PrimaryKey - the primary key of the database table;
- DataSource - an object of the WcfInstantFeedbackDataSource or WcfServerModeDataSource type.

[XML]
<dxg:GridControl><i:Interaction.Behaviors><crud:WCFInstantModeCRUDBehaviorEntityObjectType="{x:Type sr:Item}"DataSource="{Binding ElementName=wcfInstantSource}"DataServiceContext="{Binding DataSource.DataServiceContext, RelativeSource={RelativeSource Self}}"/></i:Interaction.Behaviors></dxg:GridControl>
[C#]
helper.PropertiesList.Add("Id");helper.PropertiesList.Add("Name");

See the WcfInstantFeedbackDataSource and WcfServerModeDataSource classes to learn more about WcfInstantFeedbackDataSource and WcfServerModeDataSource .

Behavior class descendants support the following commands: NewRowCommand, RemoveRowCommand, EditRowCommand. You can bind your interaction controls with these commands with ease. For instance:

[XML]
<crud:WCFServerModeCRUDBehaviorx:Name="helper"/><StackPanelGrid.Row="1"Orientation="Horizontal"HorizontalAlignment="Center"><ButtonHeight="22"Width="60"Command="{Binding Path=NewRowCommand, ElementName=helper}">Add</Button><ButtonHeight="22"Width="60"Command="{Binding Path=RemoveRowCommand, ElementName=helper}"Margin="6,0,6,0">Remove</Button><ButtonHeight="22"Width="60"Command="{Binding Path=EditRowCommand, ElementName=helper}">Edit</Button></StackPanel>

By default, the WCFServerModeCRUDBehavior and WCFInstantModeCRUDBehavior solutions support the following end-user interaction capabilities:
1. An end-user can edit selected row values by double-clicking on a grid row or by pressing the Enter key if the AllowKeyDownActions property is True.
2. An end-user can remove selected rows via the Delete key press if the AllowKeyDownActions property is True.
3. An end-user can add new rows, remove and edit them via the NewRowCommand, RemoveRowCommand, and EditRowCommand commands.

Question Comments

Added By: Claire N Streb at: 8/12/2012 9:03:43 AM    

Just in case anyone else experiences this problem, I received this error when trying to attach the provided Database.mdf file to the SQL Server database: The database '[snip]\DATABASE.MDF' cannot be opened because it is version 661. This server supports version 655 and earlier. A downgrade path is not supported. To fix it, I opened the model, generated the database from the model, added the database into SQL Server under a different name, excluded Database.mdf from the solution, added the newly created database to the solution, and changed the web.config file.

Added By: paul schwartzberg 1 at: 11/7/2016 12:23:29 PM    Indeed it does it. 

But the above  does it  -- per row -- (on all columns), and per View.KeyDown  event, in which the handler saves when

e.Key == Key.Enter

Would it be possible,
(1) per lost focus,
(2) only on columns made thus editable (not on the whole TableView)   
(3) with editing multiple cells (once column at a time) - i am looking at this demo for that
https://www.devexpress.com/Support/Center/Question/Details/T222522

right now i am working on (1) ... ideas?

If you guys had a demo that compined these two together ...
https://www.devexpress.com/Support/Center/Question/Details/T222522
https://www.devexpress.com/Support/Center/Example/Details/E3866

Applied per column (to edit multiple cells in selected columns) it would be great...

Regards,
Paul

 

ASPxGridView - How to filter a date column's values by both the date and time parts in the auto filter row

$
0
0
By default, GridViewDataDateColumn filters data by string and cuts off information about minutes and seconds (keeping only the hour part).
As a solution, you can modify the filter criteria in the ASPxGridView.ProcessColumnAutoFilter event handler to keep the time part in the filter row date values and take the time part into account when filtering.

To allow the user to define both date and time in the filter row not only by manually typing them in the input but also by using the date editor shown in the drop down, use the ASPxGridView.AutoFilterCellEditorInitialize event. Access the default ASPxDateEdit control displayed in the drop down and enable its time section by setting the TimeSectionProperties.Visible property to true.

How to hide particular rows and columns

$
0
0

The following example demonstrates how to hide particular rows and columns by handling the CustomFieldValueCells event.

In this example, the event handler iterates through all row headers and removes rows that correspond to the "Employee B" field value, and that are not Total Rows.

ASPxGridView - Batch Edit mode - How to calculate group summaries on the fly


How to edit merged cells in GridView

$
0
0

By default, GridView does not support editing of merged cells. This example demonstrates how to create a custom GridView that supports this functionality.

The saving logic is implemented in the PostEditor method. If you wish, you can change the implementation as your needs dictate.

Question Comments

Added By: Artem Lavrov at: 1/30/2014 3:53:05 AM    

It doesn't work if set this.myGridView1.OptionsView.RowAutoHeight = true;

Added By: David Lemieux at: 11/8/2016 5:09:55 AM    Correct me if I'm wrong but this solution won't play so well with grid validation mechanisms.Added By: Pavel (DevExpress Support) at: 11/8/2016 10:31:39 AM    Hi David,

I have answered your question in the Edit Merged Cell thread. Let's continue to work on this issue there.

How to use the ASPxGridView control (with the enabled vertical scrollbar) in a Full Screen mode (100% browser Width and Height)

$
0
0

This example demonstrates how to resize the ASPxGridView control based on the browser window size.

Update:
To keep the visual grid's size intact while adjusting it on the first load, wrap ASPxGridView with a hidden container and show it only after its full initialization and adjustment. For example:

[ASPx]
<divid="gridContainer"style="visibility: hidden"><dx:ASPxGridViewrunat="server"ID="gridView"...> ...</dx:ASPxGridView></div>
[JavaScript]
function OnInit(s, e){ AdjustSize(); document.getElementById("gridContainer").style.visibility = "";}

See Also:

How to use the ASPxPageControl control in a Full Screen mode (100% browser Width and Height)

Question Comments

Added By: neuDev33 at: 5/16/2012 11:48:45 AM    

I'm copy + pasting this code, but the height does not increase to cover the parent control

Added By: just wqq at: 9/18/2012 7:45:13 PM    

DevExpress.Web.ASPxGridView.v8.3 can do this

Added By: Michelle Young at: 7/31/2013 7:46:42 AM    

Visual studio says the code behind method is obsolete and you should now use RegisterBaseScript instead.

Added By: Yevgeniy Reznik at: 7/31/2013 8:45:41 PM    

Can you please update to the latest version of DevExpress?

Added By: Honesto Manlig at: 5/28/2014 9:03:24 PM    

How can I have the columns to be of width they need to be. Except for the last column to be the only one that grows to fill the rest of the gridview. For example, if there's three columns, if first column contains  text, it'll get as wide as it needs to so it does not wrap the text, then second column is a checkbox, so can always be same width, then the last column must get wide enough so that it fills the rest of the grid's width.

Added By: Artem (DevExpress Support) at: 5/29/2014 12:01:42 AM    Hello,

I've moved your question to a separate thread created on your behalf:
How to use the ASPxGridView control (with the enabled vertical scrollbar) in a Full Screen mode (100% browser Width and Height)
Please refer to it for further correspondence.Added By: Satarupa Brahma 1 at: 3/8/2016 10:37:29 AM    It is important to note that the ClientInstanceName needs to be set so that the java script can find the control that needs to be resized.   I struggled with this for several hours before I found the key.

How to display and edit XPO in the ASPxGridView

$
0
0

This is a simple example of how to bind the grid to an XpoDataSource (eXpress Persistent Objects) for data displaying and editing. It's implemented according to the How to use XPO in an ASP.NET (Web) application article.

To run the example, build the DatabaseUpdater project and run the application - this will create an appropriate database schema, so you can run the web application.

Question Comments

Added By: Hendy Harianto at: 8/21/2013 12:15:27 AM    

Dear Support,
           CustomerOrders.cs is like tables of a database? thx

Added By: Ullas Krishnan 1 at: 6/2/2014 9:20:10 AM    

Dear Support ,

That means I have three different Tables then should I need to create three different XpoHelper class for the three webpages to display each table contents ?

Thanks,
Ullas

dxDataGrid - How to get row data and event arguments in an event handler inside a template in Angular JS

$
0
0
Starting with version 16.1, the 'model' field of an argument object passed to an action is not available in the Angular approach. In addition, the action context does not hold the item object. See BC3433 - The action context does not hold an item data object and the 'model' field of an action arguments object is available only in the Knockout approach to learn more. Now it's necessary to use the following syntax to complete this task.

Markup:
[HTML]
<divdx-item-alias="itemData"dx-data-grid="grid"><divdata-options="dxTemplate : { name: 'buttonTemplate' } "><divdx-button="{ text: 'Get Info', onClick: buttonClick(itemData) }"></div></div></div>

Controller: 
[JavaScript]
$scope.buttonClick = function(rowData){returnfunction(event){// event - current event arguments//rowData - an object that contains template data}}

How to highlight the focused column header (all PaintStyles)

$
0
0

This example demonstrates how to highlight the focused column by changing its Hot state.
For more information, please refer to the A2602 Knowledge Base article.

See Also:
ColumnView.FocusedColumnChanged Event
GridView.CustomDrawColumnHeader Event
ColumnHeaderCustomDrawEventArgs.Info Property

Question Comments

Added By: Guido Geurts at: 11/10/2016 12:11:54 AM    Setting the Info.State is no good, the difference is in many themes not visible enough.
Is there any other way to do this ?

Added By: Nadezhda (DevExpress Support) at: 11/10/2016 12:40:39 AM    Hello Guido,

I see that you have created a separate ticket with a similar issue: How to hightlight the columnheader of the focused row. We will address your inquiry in the T448978 ticket as soon as we have any updates.

ASPxGridView - How to edit an image displayed in a GridViewDataImageColumn

$
0
0

By design, ASPxGridView's GridViewDataImageColumn is not editable unlike the GridViewDataBinaryImageColumn.
To implement its data editing manually, you can define EditItemTemplate for this column and place ASPxUploadControl with ASPxImage into this template to implement new image upload:

[ASPx]
<dx:GridViewDataImageColumnFieldName="ImgUrl"VisibleIndex="3"><EditItemTemplate><dx:ASPxImageID="ASPxImage1"runat="server"ShowLoadingImage="true"Width="200px"ClientInstanceName="img"ImageUrl='<%# Eval("ImgUrl") %>'></dx:ASPxImage><dx:ASPxUploadControlID="ASPxUploadControl1"runat="server"UploadMode="Auto"Width="200px"AutoStartUpload="true"OnFileUploadComplete="ASPxUploadControl1_FileUploadComplete"><ValidationSettingsAllowedFileExtensions=".jpg"></ValidationSettings><ClientSideEventsFileUploadComplete="onFileUploadComplete"/></dx:ASPxUploadControl></EditItemTemplate>

Then, save an uploaded image to the required folder in ASPxUploadControl's server-side FileUploadComplete event handler and store its path to the ASPxGridView data source in the ASPxGridView's RowUpdating event handler.

How to use the CustomCellValues event to display the original values for certain Data Fields while Running Total values are displayed for others

$
0
0

This example demonstrates how to show running totals for one field, while displaying typical total summaries for another using the CustomCellValue. Note that this event is used only to customize displayed values. Thus, running total values will be used by other operations that use Data Fields: Sorting by SummaryUnbound Expression, etc. 


See Also:
Add the capability to specify data fields for the RunningTotals feature 

Question Comments

Added By: Xavier Codina at: 3/14/2014 12:17:55 PM    

This example don't show running totals. The ProductAmount value and ProductAmount Running value are identical.
Please, fix this.

Thanks,
Xavi Codina

Added By: Constant (DevExpress Support) at: 3/20/2014 6:38:13 AM    

I have just checked this example, but have not noticed any issues. Note that the Running Total values are calculated by the "ProductName" fields. Each row cell value shows summary values calculated by all previous rows.


ASPxRichEdit - How to get a selected text on the client side

ASPxGridView - Batch Edit mode - How to remove ComboBox column items already selected in any column cell

$
0
0
This example illustrates how to remove ComboBox column items already selected in any grid cell, i.e. allow selecting only unique ComboBox values when the Batch edit mode is used.

How to customize control content on export to HTML

$
0
0

The following example demonstrates how to use the XRControl.HtmlItemCreated event to customize content of an XRLabel control when a report is exported to HTML. In the event handler, create two custom HTML elements, which will display a check box and a hyperlink on a Web page, and add them to the control's content using the ContentCell property of the event parameter.

Question Comments

Added By: Heather Mounts at: 12/28/2012 7:13:17 AM    

What screen do I stick the VB code for it to work on Lightswitch? Can I "write code" on the lightswitchapplication namespace under one of the tables?

Thanks for the help!

Heather

ASPxRichEdit - How to open SpellChecker dialog via Ribbon

How to change the scrollbar's default thumb size

$
0
0

This example demonstrates how to override the thumb size within a scrollbar using a template

Question Comments

Added By: Illya Reznykov 1 at: 11/11/2016 9:44:43 AM    

Let me add some notes:
1. The most important part is the following parameter:

[XAML]
<system:Doublex:Key="{x:Static SystemParameters.VerticalScrollBarButtonHeightKey}"> 100</system:Double>
And it is enough to define this parameter in <Window.Resources> part without overriding template for the scrollbar (DevExpress version 16.1, .Net 4.5.1).

2. Mentioned parameter defines default thumb size for vertical scrollbar, and in order to set default thumb size for horizontal scrollbar you need to use the following code:

[XAML]
<system:Doublex:Key="{x:Static SystemParameters.HorizontalScrollBarButtonWidthKey}"> 32</system:Double>

Viewing all 7205 articles
Browse latest View live


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