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

HtmlTextBox value bind to report parameter

5 Answers 207 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Arun Kumar
Top achievements
Rank 2
Arun Kumar asked on 24 Jul 2010, 07:45 AM
I want to bind htmltextbox value to report parameter. The report parameter value is:

<div style="font-family: tahoma; font-size: 10pt">
    Request from <strong>{Fields.CustomerName} ({Fields.CustomerNo})</strong> to update
    the profile information as follow:
</div>
<div style="font-family: tahoma; font-size: 10pt">
    <strong>P.O. Box</strong> {Fields.POBox}
</div>
<div style="font-family: tahoma; font-size: 10pt">
    <strong>Address</strong> {Fields.Address1}
</div>
<div style="font-family: tahoma; font-size: 10pt">
    <strong>City</strong> {Fields.City}
</div>
<div style="font-family: tahoma; font-size: 10pt">
    <strong>Country</strong> {Fields.Country}
</div>
<div style="font-family: tahoma; font-size: 10pt">
    <strong>Main Contact No</strong> {Fields.ContactNo}
</div>
<div style="font-family: tahoma; font-size: 10pt">
    <strong>Email</strong> {Fields.Email}</div>

When I run the report, I got the error 'Fields.CustomerName' is not a valid type name. Even I tried with double braces but same error. One thing I noticed, If I set this value in htmltextbox expression its working. What could be the reason?
Can someone help me?

5 Answers, 1 is accepted

Sort by
0
Steve
Telerik team
answered on 28 Jul 2010, 12:43 PM
Hi Arun Kumar,

You cannot use Fields in the Value of the report parameters, as they are usually used to filter the report datasource, thus they are evaluated prior to the expressions in the bound report.
You should change your approach, so that the data comes directly from a database field.

Greetings,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Arun Kumar
Top achievements
Rank 2
answered on 28 Jul 2010, 01:54 PM
Thanks for your reply.

The fields are already there in the report (I created sqldatasource). Just I want to show the fields with dynamic content. I used htmltextbox expression to create the value and then I copied that value and passed through parameter field. If I directly set htmltextbox expression with that value its working perfectly. Please give me some example or link related to your suggestion?
0
Steve
Telerik team
answered on 30 Jul 2010, 04:13 PM
Hello Arun,

From your second explanation we are left with the impression that you want to use a single report for multiple layouts and data, which is not a good approach.
To elaborate more on why your initial approach cannot work. The report parameter value is used to set an initial value for the parameter. Its value depends on the parameter type and it can accept even an user defined function as long as it does not have database field as argument. You cannot set a database field as value for a parameter since parameters and filters are used to filter the datasource. Thus you cannot filter the datasource of the report based on a parameter which depends on the database fields from the datasource.
What you need to do is display the values directly from the database into the HtmlTextBox and if need be create several different reports based on your needs and data.
We're not very sure of the exact meaning of this sentence: Just I want to show the fields with dynamic content - since the data comes from database it is dynamic. But you cannot use the parameters as filler for the date in the report as this is not their purpose.

All the best,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Arun Kumar
Top achievements
Rank 2
answered on 30 Jul 2010, 06:22 PM
Hi,
Actually I want to create different type of letters to customers. So I decided to use htmltextbox. I have created sqldatasource for customer master. The letter content is coming from report parameter. This content is vary for each type with customer name, address, contact no and some other fields.
For example:
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Date: 01-Jan-2010

To
Mr. Darshan Singh,
123, Road 12, Block 12,
Khandmala,
India

This is letter content....

Kind Regards,
Customer Service
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Only customer name and address from sqldatasource other details are coming from parameter. There are more than 50 type of letters I want to create. Its hard to create single report for each letter. That's why I go with htmtextbox. There  is no filter in this report. How do I achieve this?
0
Hrisi
Telerik team
answered on 05 Aug 2010, 08:57 AM
Hello Arun Kumar,

Your case is very similar to the mail merge. This scenario can be accomplished by Telerik Reporting using embedded expressions as you already do. As I understand the only problem is how to supply data for the report. The data for the recipients should come from the your concrete data source. We have prepared an example which presents our understanding of the problem. Sample data is represented as class Recipients (see MailMerge.cs). We use only one HtmlTextBox for the full letter. Please, review it and let us know if you have additional troubles with such scenario.

Sincerely yours,
Hrisi
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
Arun Kumar
Top achievements
Rank 2
Answers by
Steve
Telerik team
Arun Kumar
Top achievements
Rank 2
Hrisi
Telerik team
Share this question
or