Showing posts with label Infragistics. Show all posts
Showing posts with label Infragistics. Show all posts

Monday, November 23, 2009

SelectedIndex if nothing selected

SelectedIndex property of Infragistics' WebCombo class has the following syntax


public int SelectedIndex {get; set;}

The documentation reads 'If no row is selected, this property returns Nothing or Null.' That sounds suspiciously since int cannot be null.

The property actually returns -1 if there are no selected rows.

By the way, the index is zero-based, i.e. the first row has the index 0.

Thursday, November 12, 2009

'+' not supported in datakey

Users reported us that sometimes the selection is lost in UltraWebGrid. We managed to discover that the problem occurs only when the key column contains '+'. The selection is recognized OK on client side, but on server side it behaves as if the selected row was the one without '+', i.e. none if there was no such row.

Having the data source


[DataObject]
public class DataProvider
{
[DataObjectMethod(DataObjectMethodType.Select)]
public static IEnumerable SelectData()
{
yield return new { Column1 = "a+b" };
yield return new { Column1 = "a b" };
}
}

and the grid

<igtbl:UltraWebGrid ID="UltraWebGrid1" runat="server" DataSourceID="ObjectDataSource1">
<Bands>
<igtbl:UltraGridBand DataKeyField="Column1">
<Columns>
<igtbl:UltraGridColumn Key="Column1" BaseColumnName="Column1" IsBound="True"></igtbl:UltraGridColumn>
</Columns>
</igtbl:UltraGridBand>
</Bands>
<DisplayLayout …>…</DisplayLayout>
</igtbl:UltraWebGrid>

you can select the row with "a+b", but once you enter server code (e.g. for server event handling), the selection is changed to "a b".

We needed to introduce another column to store the key value with '+' escaped somehow (e.g. replaced for another character).

Updated 3 February 2010:
I have been told by a colleague that even server events are not raised for a row having '+' in its key.

Tuesday, April 21, 2009

Strange values in chart

Infragistics stacked column chart allows to display both negative and not negative values. However, I was adding some post processing based on values and discovered that one has to be careful with Box.Value.

Among others I had a stacked column with values 0, -50, 0, 50, 0. This is what I obtained (Box[][] rows were collected from SceneGraph by Row and Column):


((NumericDataPoint)rows[3][0].DataPoint)
Value: 0.0
((NumericDataPoint)rows[3][1].DataPoint)
Value: -50.0
((NumericDataPoint)rows[3][2].DataPoint)
Value: 0.0
((NumericDataPoint)rows[3][3].DataPoint)
Value: 50.0
((NumericDataPoint)rows[3][4].DataPoint)
Value: 0.0

rows[3][0].Value
0.0
rows[3][1].Value
-50.0
rows[3][2].Value
-50.0
rows[3][3].Value
50.0
rows[3][4].Value
-50.0


There is a kind of warning in the documentation of Box.Value:

The intent behind any data objects referenced by this property are dependent upon the Layer that added this Primitive to the scene graph.
They tend to use it, though, as I saw on forums.

I spent some time trying to find better way then casting Box.DataPoint to NumericDataPoint, but I failed.

Wednesday, November 26, 2008

Infragistics.Documents versus ActiveReports

PDF document had to be rendered from an application. We used to use ActiveReports for PDF reports, but have experienced difficulties when maintaining them. I gave a try to Infragistics.Documents library. It looked nice, but a lot of coding would be required. I think one could prepare some set of classes that would allow fast creation of documents, but it would take some time we did not have. I had to admit, that it is much faster to create the document in ActiveReports, using the visual designer.
Perhaps this is just another prove of the rule "the less code you write the better".

Tuesday, February 12, 2008

WebNumericEdit and Nullable<decimal>

I was binding Infragistics WebNumericEdit to a Nullable<decimal>. I had to set DataMode of control to NumericDataMode.Decimal. I set Nullable property to true since the value may be missing. (That is also the reason why we store the value as Nullable<decimal>.) It seemed working, but then I noticed that 0 is propagated to data instead of null. So it seems that Nullable<decimal> is not directly supported by WebNumericEdit.

After the short brainstorming, the decision was made to try to override the way how data are provided. Finally, this was sufficient to do:


public class WebNullableNumericEdit
: WebNumericEdit
{
public override object Value
{
get
{
return (this.Nullable &&
this.Text.Equals(this.NullText)) ?
null : base.Value;
}
set { base.Value = value; }
}
}