Today I needed to do a simple thing: Combine selected values of .NET CheckListBox control into a comma separated string. I am lazy, so I decided to Google for a ready-to-use piece of code. Sure enough there’re tons of those. But all of them involve looping through control items, checking IF item is selected, then adding values.. Boring, routine stuff.
People! We live in the 21st century, age of inspiration! Uhm.. sorry, got carried away. Bottom line: I didn’t like any of those solutions and being a fan of LINQ I put together one of my own. Continue reading 'CheckListBox to comma-separated string'»
Working with row selection in Infragistics WebHierarchicalDataGrid can be complicated since it maintains independent row selection collection for each row island and basic operations (select/unselect) aren’t that obvious. I put together a few functions to make it a little bit easier.
This first function is very basic, it returns total count of selected rows across all expanded row islands, no matter what depth. The key here is get_selectedRowsResolved() method of Selection behavior which returns an array of all selected rows:
// Returns number of selected rows from all rowislands in WebHiearchicalDataGrid
// i_oGrid: Infragistics WebHiearchicalDataGrid object
function selRowsCount(i_oGrid) {
return i_oGrid.get_gridView().get_behaviors().get_selection().get_selectedRowsResolved().length
}
The following function loops thru all selected rows, collecting values from specific column (useful for example for collecting IDs of selected rows). It accepts 3 parameters – WebHiearchicalDataGrid object, column key and separator character and returns a string in which selected values are separated by that character (if nothing is passed – default separator is comma). Continue reading 'WebHierarchicalDataGrid: Helpful client functions for row selection'»
In the previous post I described a method to automatically resize columns for Infragistics grid control. It works (most of the times) for flat WebDataGrid, but if you try same approach with WebHierarchicalDataGrid – it will fail for child bands.
Lets review what we’re trying to accomplish. A grid column should automatically resize to whichever is wider: either size of widest data in a column cell, or size of column header’s caption.
First is accomplished by not setting column width explicitly and by setting white-space attribute of cell’s style to nowrap. It can be done by either opening grid CSS class file located at ~/ig_res/[Your Style Name]/ig_dataGrid.css, locate tbody.igg_[Your Style Name]Item>tr>td class and add one more line at the end: white-space:nowrap. Here is an example with Office 2007 Style:
tbody.igg_Office2007BlueItem>tr>td
{
background-color:White;
border-right:solid 1px #D0D7E5;
border-bottom:solid 1px #D0D7E5;
padding:2px 5px 2px 5px;
height: 18px;
overflow: hidden;
text-align:left;
vertical-align:middle;
white-space:nowrap;
}
Or (if you don’t want to touch original style) same can be achieved by *CssClass properties exposed by the grid.
Second (resizing column to header’s caption width, if it is wider then cells’ data) is a bit tricker. Continue reading 'Improved Auto-size columns for Infragistics WebHierarchicalDataGrid'»
Infragistics Aikido WebDataGrid offers a nice built-in ColumnMoving behavior. When enabled – it allows user to drag columns to change their order:

But what if you want to keep this behavior and add your own custom column drag-and-drop? For example to create your own column grouping, since WebHierarchicalDataGrid doesn’t handle grouping well.
In this post I will describe a simple technique how to both keep behavior shown above and implement custom column drag-and-drop:

Continue reading 'WebDataGrid: Custom drag and drop columns when Colum Moving behavior is enabled'»
ASP.NET, HTML/CSS, Infragistics, Javascript, New Stuff, VB.NET
|
cool, design, extending, feature, solution, trick
Infragistics UltraWebGrid offers a nice grouping feature: when the grid is in OutlookGroupBy mode, you can group similar data with very little coding required, you can go from this view:

to this:

by just dragging columns to designated area.
But what if you want to group by first letter of a name or a year of a date? New WebHierarchicalDataGrid control offers this functionality after 10.2 release of Infragistics NetAdvantage, but if you invested years of work in classic UltraWebGrid – it’s not easy to move to a brand new control cold turkey. There’re other methods that offer custom grouping for UltraWebGrid, but the ones I found were pretty convoluted (like create a hidden column, populate it with data to group by etc.) Here is a simpler approach. Continue reading 'Custom grouping in classic Infragistics UltraWebGrid'»
Infragistics UltraWebGrid offers rich set of features, among which paging of large sets of data. But if your total-number-of-records/records-per-page ratio is too high you will end up with way too many page links. And it doesn’t look pretty:

UltraWebGrid offers some out-of-the-box solutions for this problem. Continue reading 'Create enhanced pager for Infragistics UltraWebGrid'»
TNX Corp allows you to place static ad links on pages of your site, so you can earn some profit. Unfortunately if you leave it to TNX system, automatic rate at which links are sold and paced on your site could be very slow. You can add links to your pages manually via TNX site interface, but it is only allowed if your page Google PageRank is above 0. Also manual placement can be really inconvenient and you cannot place more than 4 ad links.
Fortunately there is a solution. Continue reading 'TNX Text Links Ads: How to automatically fill all your ad spots (including pages with 0 PR) and other tricks'»
Last year I described a way to display accurate row count when grid in OutlookGroupBy mode has multiple sub-groups.
That solution requires custom counting function. Fortunately to display aggregates such as SUM, AVG, MIN and MAX UltraWebGrid has a built-in functionality in form of GroupByRowDescriptionMaskDefault property of DisplayLayout. It specifies the string to be displayed in every GroupBy row and can include following substitutes:
- [caption] – will display GroupBy column header text
- [value] – will display common to the group cell value
- [count] – will display row count (does not work correctly with sub-groups)
- [avg], [sum], [min], [max] – will display the aggregate for the column it’s grouped by
- [avg:ColumnKey], [sum:ColumnKey], [min:ColumnKey], [max:ColumnKey] – will display the aggregate for any other column, where ColumnKey is the key of the column
With this in mind in just a few simple steps we can make UltraWebGrid to display something like this:

Continue reading 'UltraWebGrid in OutlookGroupBy Mode: How to display custom aggregates (SUM, AVG, MIN, MAX) in GroupBy row'»
Dundas Charts for .NET has many cool features like async callbacks, AJAX scroll and zoom, plenty of chart types and great visuals, but in some cases some of those features could turn out to be more of a burden than useful. One example – the ability to set chart type for each individual series of a chart. This offers great flexibility in building combination charts (you can display column and line on the same chart to reflect different series’ data), but you’re losing the Infragistics simplicity of just setting the chart type and binding chart to data without worrying about appearance of each individual series.
This is especially inconvinient if you load chart appearance (including series appearance and chart type) from an external template. If you want to use chart type from the template, but feed it your own data – you’re stuck. But there is a solution. Continue reading 'Global Chart Type for Dundas Chart Control'»
Sessions are a great way to share variable across your entire application, but they’re not accessable directly in class modules since they’re outside of page scope. So if you try something like Session(“VariableName”) = value inside of your class, you will get an error.
Fortunately there is a way. Thru HttpContext.Current notation available such common properties as Session, Server, Application, Cache. So to access your session variable inside a class just use HttpContext.Current.Session(“VariableName”) = value