How To Pass Particular (Control ID) Parameter to .rdlc Report or Crystal Report Using Asp.Net


 Pass  Particular Parameter to .rdlc Report


How To Pass Parameters  To  .rdlc Reports  Using Asp.Net  C#  .  Sql Query Using (Where Condition)  Partiular Field Select.

DEMO



HTML CODING


<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div> 
             
        <asp:TextBox ID="TextBox1" runat="server">3</asp:TextBox>       
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>       
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
            <LocalReport ReportPath="Report.rdlc">
                <DataSources>
                    <rsweb:ReportDataSource 
DataSourceId="ObjectDataSource1" Name="DataSet1" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" 
InsertMethod="Insert" OldValuesParameterFormatString="original_{0}"
 SelectMethod="GetData" 
TypeName="DatabaseDataSetTableAdapters.billTableAdapter">
            <InsertParameters>
                <asp:Parameter Name="billno" Type="String" />
                <asp:Parameter Name="name" Type="String" />
                <asp:Parameter Name="amount" Type="String" />
            </InsertParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="TextBox1"
 Name="billno" PropertyName="Text" Type="String" />
            </SelectParameters>
        </asp:ObjectDataSource>       
   
    </div>
    </form>
</body>

</html>


First  - Add New Web Form - Name - Crystal Report 








Next  - Add - Sql Server Database -  Click - Add  









Click -  Yes Button  - Add to App Data Folder








Next - Select Table - Right Click  - Add New Table 









Add - The  Field Name & DataType   billno,name,amount









Next - click - Update - Update Database  -   Refresh Server Explorer










Next - Right Click - bill Table - Click -  Show Table Data 










Next - Enter the Field Values  billno,name,amount














Next - Select  the  Web Form -  Select - ToolBox - Reporting - Select - Report Viewer 








Next - Select  - Solution Explorer - Right Click  - Add -Add New Item - Select Report - Add 










Next - Select -  New - DataSet  From Report.rdlc File










Next - Select - Database  Name - Click -  Next Button 










Next - Select  - DataConnectinString - Click - Next Button










Next - Select  - Table - Required Table Name  -  Click - Finish  Button









Next - Open Window Form - Select  Name , Data Source , Available Datasets  Click - OK Button 












Next - Go To - Report.rdlc  - Select - DataSet1 









Next - Select - Toolbox - Select  Table Tool 









Next  - Right Click the Table  - Add Field Name - billno








Next  - Right Click the Table  - Add Field Name - name










Next  - Right Click the Table  - Add Field Name - amount









                         Display  the  Added  Fields








Next - Select - DataBaseDataSet.xsd -   Right Click  - Fill GetData() - Click - Configure  









Next -  Write  Coding For Where Condition  using billno - Click - Finish button








Next - Select  Webform -  Select Toolbox - AJAX Extension -  Add the  ScriptManager








Next -  Right Click the Report Viewer  - Select - Choose Report -  Select  - Report.rdlc  Report 

Automatically Add the ObjectDataSource









Next  - Add the One TextBox or Label  or Variable    -  Go to -  Property(F4) -  Text =1   or Required Value









Next - Select - ObjectDataSource -   Right Click - Configure  Data Source 







Next  - Choose Your Bussiness Object  - Click - Next  - Button







Next - Choose  a Method  & Method Signature - Click - Next Button 







Next - Select - Parameter Source = Control  Control ID = TextBox1 (Where  Condition) - Click -   Finish Button









Next -  Select WebForm -  Right Click - Click View in Browser 










Display billno =1  Details  Because TextBox 1 Values Using Where Condition









Next - Change the Textbox Value = 2

Display billno =2  Details  Because TextBox 2 Values Using Where Condition









Next - Change the Textbox Value = 3


Display billno =3  Details  Because TextBox 3 Values Using Where Condition.










Next -  Select  PDF Button - Click PDF 








Download PDF Formate  Bill





                                                

How To Pass Parameter to .rdlc Report or Crystal Report Using Asp.Net

 Pass Parameter to .rdlc Report



How To Pass Parameters  To  .rdlc Reports  Using Asp.Net  C#  .  Sql Query Using  All Field Select.



DEMO


                  HTML CODING



<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
      
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
       
        <rsweb:ReportViewer ID="ReportViewer1" runat="server" 
Font-Names="Verdana" Font-Size="8pt" WaitMessageFont-Names="Verdana" WaitMessageFont-Size="14pt">
            <LocalReport ReportPath="Report.rdlc">
                <DataSources>
                  <rsweb:ReportDataSource 
DataSourceId="ObjectDataSource1" Name="DataSet1" />
                </DataSources>
            </LocalReport>
        </rsweb:ReportViewer>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
 InsertMethod="Insert"
 OldValuesParameterFormatString="original_{0}"
 SelectMethod="GetData" 
TypeName="DatabaseDataSetTableAdapters.billTableAdapter">
            <InsertParameters>
                <asp:Parameter Name="billno" Type="String" />
                <asp:Parameter Name="name" Type="String" />
                <asp:Parameter Name="amount" Type="String" />
            </InsertParameters>
         
        </asp:ObjectDataSource>
   
    </div>
    </form>
</body>

</html>





First  - Add New Web Form - Name - Crystal Report 








Next  - Add - Sql Server Database -  Click - Add  









Click -  Yes Button  - Add to App Data Folder









Next - Select Table - Right Click  - Add New Table 









Add - The  Field Name & DataType   billno,name,amount









Next - click - Update - Update Database  -   Refresh Server Explorer











Next - Right Click - bill Table - Click -  Show Table Data 










Next - Enter the Field Values  billno,name,amount









Next - Select  the  Web Form -  Select - ToolBox - Reporting - Select - Report Viewer 









Next - Select  - Solution Explorer - Right Click  - Add -Add New Item - Select Report - Add 










Next - Select -  New - DataSet  From Report.rdlc File










Next - Select - Database  Name - Click -  Next Button 










Next - Select  - DataConnectinString - Click - Next Button










Next - Select  - Table - Required Table Name  -  Click - Finish  Button










Next - Open Window Form - Select  Name , Data Source , Available Datasets  Click - OK Button 












Next - Go To - Report.rdlc  - Select - DataSet1 









Next - Select - Toolbox - Select  Table Tool 









Next  - Right Click the Table  - Add Field Name - billno









Next  - Right Click the Table  - Add Field Name - name










Next  - Right Click the Table  - Add Field Name - amount









                         Display  the  Added  Fields








Next - Select - DataBaseDataSet.xsd -   Right Click  - Fill GetData() - Click - Configure  









Next  - Select  -  All Table Fields  -  Finish Button Click









Next - WebForm - Add - ScriptManager  From - ToolBox










Next - Select  Report Viewer - Right Click  - Choose Report  - Report.rdlc



Automatically  -  Added  the ObjectDataSource











Next - Select  the  WebForm - Right Click - View in Browser - Click










          

Display  the  All DataBase  Field Vaues 











Select - PDF  -  Click   PDF Formate  Bill Generate & Download 









                                      
                                                Pdf Formate Bill