NET Web Forms, ASPxGridView. Contribute to DevExpress-Examples/ aspxgridview-how-to-print-an-edit-form-content-e development by creating an. It is necessary to use a separate ASPxGridViewExporter component for exporting ASPxGridView’s content to the required output formats. Description: printing engine for instant ad-hoc reporting, without fear of performance penalties. Grid Column and Row Types Standard Grid View: Easily .

Author: Mazahn Goltibar
Country: Argentina
Language: English (Spanish)
Genre: Relationship
Published (Last): 12 August 2008
Pages: 33
PDF File Size: 3.21 Mb
ePub File Size: 9.12 Mb
ISBN: 827-7-80436-858-1
Downloads: 96085
Price: Free* [*Free Regsitration Required]
Uploader: Vur

This article appears in the Third Party Products and Tools section.

datagrid – How to print the contents from Devexpress Grid? – Stack Overflow

Articles in this section are for the members only and must not be used to promote or advertise products in any way, shape or form. Please report any spam or advertising. The attached project is written in Visual Studio The express version should be enough. The database is part of the project and it will be automatically mounted by VS.

You can change this easily be creating your own database and changing the connection string in the web config. Last but not least you will need the NET controls installed on your machine. If you do have a more recent version, upgrading the project should be easy. Check this article about how to get the DevExpress controls and on how to eventually upgrade the project http: At the end the result should be similar to this, however there is much more, so check this article till the end.

You can check it also LIVE. Live version persist the data in the session so each new session will reset all the data you have inserted. Also because of this, it is a bit simplified. If you are interested in the code, I can provide it to you, just ask in comments. First of all we will create a table that will store all of our credit cards. It will contain the following columns:.

The table is structured in the following way:. Here is the complete SQL script that will do the necessary.

Now if you run your solution you should see something similar: Now we can run our code and check the result. As you can see, we added three new lines.

Also as the ShowPopup functions second parameter we will pass the cells client ID so the pop-up can be shown next to the cell. Now we can run and test our code. When an item in the GridMenu is clicked, this is the code that is executed on the client side. We are checking in the switch statement the name of the clicked item and based on that executing the indicated operations. This flag will aspzgridview used to understand if we are editing a note or we are adding a new onse since we will use the same popup for both operations.

Then we make sure that the text of our ASPxMemo control is set to empty and set a popup control header to ‘Add Note’ same reason as before, it is aspxgirdview shared control for between different actions.

Then we prinf showing the popup and setting the aspxgridvview on ASPxMemo control. Similar things for EditNote except that as the last thing we are performing a callback on a popup control. We do that so we can retrieve the note data as we do not have them available on client side at ;rint not easily available, still the will be html encoded and we will have some trouble re-encoding the same data.

If you check popupAddNote definition you will see that we already declared OnWindowCallback event, now let’s check it’s implementation:. Well we are persisting the visible index and field name in variables that are globally accessible, so we can use them later.

Now we will hide or show different menu items aaspxgridview on what are actually the operations that we can perform. If the cell already contains an note, we can modify the note or delete it, otherwise if the cell has a value but doesn’t the note we can only add a new note.


This basically ecplains the next three lines aspzgridview code as them translate that into the code. Now we will determinate the windows event as it is handled in a specific way on different browsers and then prevent this event and bubble by using a helper method that is available in DevExpress client site framework.

This event determination is necessary in order to make the popup menu work properly on all major browsers of today. And the last important thing is showing the aspxgridvidw itself. We will show the menu only on cells that has a value and we will achieve that by calling a ShowAtPos method and calculating the right coordinates again via DevExpress framework helpers. Let’s run our example and test it.

The following screen is what you should see once you try to add a new note. Articles Quick Answers Messages. Please Sign up or sign in to vote. You can read the introduction about what are the Devexpress controls, how and where to get them, versioning information and prerequisites in my previous article which you can find at this address http: What we pirnt going to achieve in this post is a simple application that will list the credit cards and the amount spent per card per month.

We will be able to add in an easy way a new sapxgridview card and edit all of the months imports. More, we will be able aaspxgridview add a note on each month and visually see the months containing notes.

ASPxGridView Excel style – Adding notes to grid cells – CodeProject

In this example I will use a database and create two simple tables that will contain all or data. Again, this will be a simple example and it awpxgridview not meant to be functionally correct. My only goal is to aspxgridvieew you how to interact with this controls in order to achieve a certain functionality, which in this case is showing, adding and modifying notes in a similar way Excel does it.

Table of contents The necessary and the result Creating database schema Writing the data service Creating the page Defining the ASPxGridView Showing cells with notes Showing notes in a popup screen Adding, editing and removing notes Changing the year Downloads and the source code Final word The necessary and the result The attached project is written in Visual Studio Creating database schema First of all we will create a table that will store all of our credit cards.

It will contain the following columns: The table is structured in the following way: One parameter will be required, in relation of which we are going to retrieve all the data and pre-format for presentation.

We need to retrieve card name, imports and notes for all the months of the indicated year. Mario Majcica — Create date: As I would like to have a combo showing all the years present in the database aspxgricview the current and subsequent year, in order that the user can filter the list by this values, I will first prepare a method that will retrieve and prepare this data.

ConnectionStrings[ ” DefaultConnection” ].

Add int reader[ 0 ], reader[ 0 ]. Add ” note”SqlDbType. Add ” year”SqlDbType. Add ” month”SqlDbType.

Open ; return cmd. Open ; return string cmd. First will show the text Selected Year and the second one will list all the years that we will retrieve via GetYears method. Please forgive the usage of the tables for setting up the layout, div’s always bothered me, specially when vertical alignment is in question.

Also I will add an ObjectDataSource that will be used for binding. Right now the aspxgridvisw will not run correctly because we have no client side event in our JavaScript file specified, but do not worry, as soon as we specify our grid, we will write down the necessary.

This is the missing code. Let’s now define the grid. I will show you the complete code of the grid aspxgrudview then discuss all the properties and events I have used. We defined a column for a card name, one for each month and a column that will show the total per card.


Total column is unbound and I we will perform the calculations for this column in CustomUnboundColumnData event. As you can imagine FieldName property is the name of a column in the binded DataTable, Caption is a column header text and ToolTip is well a tool tip for that column header. DisplayFormatString is a formatting string option N2 is this case formats the value as integral and decimal digits, group separators, and a decimal separator with optional negative sign, with decimal precision of two and NullDisplayText when no data is supplied is set for styling purposes to a slash character.

For the card name and total column, we also specified what should be shown when the row is in edit. By adding ASPxSummaryItem we are specifying the column that needs to be took in consideration by indicating ShowInColumn property we are positiong in the indicated column the result of our summaya SummaryType that should be performed Sum in this case and a field on which the calculation should be based. We set some properties on the grid so let’s check what is the behavior of these settings.

SettingsPager mode ShowAllRecords basically disables the pager meanwhile the SettingsEditing mode Inline sets the editing mode to inline. We also decided to show a Footer necessary for Summary row and to show a title panel, an extra row on top of the grid that will show a specific label, at example the meaning of the data that is shown in the grid, which we later set to “Credit Cards Year Overview” in SettingsText Title property.

DXperience 7.2.7 released on 17 Dec 2007 and What’a New

Also we disabled the Drag and Drop on awpxgridview re-orderable columns feature of ASPxGridView that is not desired in this casedisable out of the box sorting feature feature and enabled a row visual tracking EnableRowHotTrack makes the row that is under the mouse cursor highlighted. In order to perform a custom calculation for our Total column we defined the CustomUnboundColumnData event.

This is his server side implementation.

If column value is DBNull. Value then zero is used, else a column value is converted to Decimal and then summed.

It is time to bind our grid and check the result. I choose to use the DataBinding event in order to assign the right source to the grid. Pretty neat and nice result for a relatively small effort, isn’t it? Showing cells with notes Now the idea is to set for each cell that contains a note, a specific background image so the user on the first sight can understand that there is a note for that import.

In order to set dynamically a background on a cell we need to declare HtmlDataCellPrepared on our grid. FieldName ; if note! As our DataSource contains extra columns that contain notes, the name of the column is N plus the number of the month column to which it is associated to, we can easly establish the name of the column by checking the current processing items column and request the note by e.

GetValue method in which we will pass the name of the Note column we are searching the value for at example if we are processing the January column which is called 1, we will search on the current processing row the value of the column N1 which will eventually contain the note. Now if the note is not DBNull.

Value and note is not null, we will add the processing cell style attributes background-image and background-repeat to desired values, for the first one the image we chose and for the second one the repeat behavior which in this case should not repeat.

The result is that all cells that contains a note do have a different background and they can be quickly spotted by the user.