HtmlTextBox value bind to report parameter

6 posts, 0 answers
  1. Arun Kumar
    Arun Kumar avatar
    60 posts
    Member since:
    Nov 2009

    Posted 24 Jul 2010 Link to this post

    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?
  2. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 28 Jul 2010 Link to this post

    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
  3. DevCraft banner
  4. Arun Kumar
    Arun Kumar avatar
    60 posts
    Member since:
    Nov 2009

    Posted 28 Jul 2010 Link to this post

    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?
  5. Steve
    Admin
    Steve avatar
    10941 posts

    Posted 30 Jul 2010 Link to this post

    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
  6. Arun Kumar
    Arun Kumar avatar
    60 posts
    Member since:
    Nov 2009

    Posted 30 Jul 2010 Link to this post

    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?
  7. Hrisi
    Admin
    Hrisi avatar
    221 posts

    Posted 05 Aug 2010 Link to this post

    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
Back to Top
DevCraft banner