locked
Passing String to Rdlc's TextBox RRS feed

  • Question

  •  

    Hello

     I am pretty new to reporting services. Now i have something like this. on the .cs file, i have a fullName lets say

    String fullName = "John Smith",

    Now I want to pass this string to the report's textBox and show this value on this textbox.

     

    How can i do this?

    1.How should i write in .cs file?

    2. How should i set the expression for the textbox?

     

    Thank you very much. It is very urgent! Please help!

    Wednesday, January 23, 2008 9:38 PM

Answers

  • Hi,

    First write a function in which it assigns a value for fullname="John smith".(for exampleStick out tongueublic function GetString1())

    1)Build that .cs file.

    2)Copy the dll file of that particular project.

    3)Paste that dll file in to the following path

    C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies  and also in to the private assemblies.

    4)Then open your Report property tab on your menu bar.

    5)Click on Report property option.

    6)In that click on References.

    7)For Assembly name ,,just browse for the .cs built dll file.

    8)For class name,you need to provide the namespace and class name .

     For example: namespace.classname

    9)Instance name you can give anything(for exampleSurprisebj)

    10)Then in the texbox call code.obj.GetString()

     

     

    Let me know whether it works for you

     

    Regards,

    Shrinidhi

     

     

    Thursday, January 24, 2008 5:37 AM

All replies

  • Hi,

    First write a function in which it assigns a value for fullname="John smith".(for exampleStick out tongueublic function GetString1())

    1)Build that .cs file.

    2)Copy the dll file of that particular project.

    3)Paste that dll file in to the following path

    C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies  and also in to the private assemblies.

    4)Then open your Report property tab on your menu bar.

    5)Click on Report property option.

    6)In that click on References.

    7)For Assembly name ,,just browse for the .cs built dll file.

    8)For class name,you need to provide the namespace and class name .

     For example: namespace.classname

    9)Instance name you can give anything(for exampleSurprisebj)

    10)Then in the texbox call code.obj.GetString()

     

     

    Let me know whether it works for you

     

    Regards,

    Shrinidhi

     

     

    Thursday, January 24, 2008 5:37 AM
  • Hi,

     

    I've resolved this problem using report parameters:

     

    Add a parameter to your report and name it for example TextBoxString.

    Then right click the textbox, select Expression and from the Expression form select Category: Parameters and Parameter: TextBoxString.

    In the reportViewer's code file before refreshing the report, add the following code:

     

     

    //set TextBoxString parameter

    string textBoxString = GetTextBoxString();  //a function for create a string

     

    Microsoft.Reporting.WinForms.ReportParameter[] p = {new ReportParameter("TextBoxString", textBoxString)};

    this.reportViewer.LocalReport.SetParameters(p);

     

    Friday, July 18, 2008 11:48 AM
  • Question you guys ,I know how to easily create a rdlc parameter in 2008, but I dont know to create a parameter in VS 2010. How do we create a rdlc parameter in 2010?
    Sunday, September 5, 2010 2:02 PM
  • Hallo,

    I had the same problem a vew days befor. But Elmar Boye could give me the very best answer:

    (My english is not very good, so here the details in german):

    - öffen der *.rdlc Form, anlegen einer Textbox

    - Strg+Alt+D clicken, es erscheint ein Fenster "Berichtsdaten"

    - RClick auf "Parameter", Click auf "Parameter hinzufügen"

    - erscheint Form "Berichtsparameter Eigenschaften" : Name eingeben, Datentyp wählen

    - RClick auf die Textbox : Ausdruck(fx)  - Parameter - Werte: hier findet sich der Name wieder

    - DoppelClick auf den Namen - OK

    - Und das war es auch schon.

    Gruß !

    Hermann


    Monday, September 13, 2010 4:38 PM
  • GetTextBoxString(); and new ReportParameter wont recognize in the code when I try and apply it to my project.

    How come?

    Thursday, September 23, 2010 3:26 AM