This is a migrated thread and some comments may be shown as answers.

Reading Hashtable in Report

2 Answers 39 Views
Report Designer (standalone)
This is a migrated thread and some comments may be shown as answers.
Prasant
Top achievements
Rank 1
Prasant asked on 26 Feb 2013, 01:53 PM
I want to show the Hashtable data in textbox of Telerik report. My class structure is like:

Public class MyClass
{
public Hashtable ValHash { get; set; }
}

MyClass obj = new MyClass();
obj.ValHash = new Hashtable();
obj.ValHash.Add("Name", "Prasant");

While setting Hahtable value to textbox, as:
this.textBox1.Value = "= Fields.ValHash[\"Name\"]";

I am getting an error as "Missing operator before '["Name"]' operand.

Am i doing anything wrong?

2 Answers, 1 is accepted

Sort by
0
Stef
Telerik team
answered on 01 Mar 2013, 01:49 PM
Hi Prasant,

Our expression engine does not support indexers, and that is how the values in a Hashtable are accessed, using an an indexer by Key. We can suggest you two approaches:
  • Flatten your data in a DataTable object, e.g. the Key is a Column, and the Value is the value for that column, then you can bind the TextBox item to the field with the corresponding column name;
  • Have user-defined function to get a value by key from the Hashtable as illustrated in the attached sample. The function is used as an expression for the TextBox item Value property, where we pass the Hashtable object field and the searched key;

I hope this helps.

Greetings,
Stef
the Telerik team

See what's new in Telerik Reporting Q1 2013. Register for the March 4 webinar to witness the impressive new visualizations in Telerik Reporting. Just for fun, 10 webinar attendees will be randomly selected to win a Telerik T-shirt and a $50 Gift Certificate to ThinkGeek. Register now! Seats are limited!

0
Prasant
Top achievements
Rank 1
answered on 05 Mar 2013, 07:31 AM
Hi Stef,
Thanks for your response. I would prefer 2nd option suggested by you.
Tags
Report Designer (standalone)
Asked by
Prasant
Top achievements
Rank 1
Answers by
Stef
Telerik team
Prasant
Top achievements
Rank 1
Share this question
or