1
Answer

how to use crystal report in asp.net to print a bill

how to use crystal report in asp.net to print a bill
step by step to use CrystalReport to print a bill  from a table .
if i select a particular field from a dropdown i need that data to print 


<table width="50%" align="center" style="border-color: #1d599e; border-style: outset;
        border-width: thin; background-color:  #D7D7D7"  >

                <tr>
            <td style="margin-left: 80px; background:#1d599e;" align="center"  colspan="2"
                        class="style1">
                
                      MONTHLY &nbsp; REPORT</td>
                     </tr>
                <tr>
                <td align="right" class="style2">
                    Product</td>
              <td align="left">
                   <asp:DropDownList ID="DropDownList1" runat="server">
                  <asp:ListItem>Cement</asp:ListItem>
                  <asp:ListItem>Seed</asp:ListItem>
                  <asp:ListItem>Pesticide</asp:ListItem>
                  <asp:ListItem>Fetilizer</asp:ListItem>
                  </asp:DropDownList>&nbsp;</td>
              </tr>              
                
                
                <tr>
                <td align="right" class="style2">
              
                  <asp:Label ID="Label20" runat="server" Text=" From Date"></asp:Label>
              
              </td><td>
                        <asp:TextBox ID="txtfrmdate" runat="server"></asp:TextBox>
                </td>
                </tr>
                
                
                
                
                
                
                
                  <tr>
                <td align="right" class="style2">
              
                  <asp:Label ID="Label1" runat="server" Text="To Date"></asp:Label>
              
              </td><td>
                  <asp:TextBox ID="txttodate" runat="server"></asp:TextBox>
                  
                  
              </td>
                </tr>

                
               <tr><td class="style2"></td>
              <td align="left">
              
                  <%--<asp:Button ID="Button1" runat="server" Height="21px" onclick="Button1_Click2"  OnClientClick="return attendance()" 
                        Text="Search" Width="82px" Font-Bold="True" />
              --%>
                  <%--<asp:Button ID="Button3" runat="server" Height="21px" onclick="Button1_Click2"  OnClientClick="return attendance()" 
                        Text="View" Width="82px" Font-Bold="True" />
                  --%>  
                  <asp:Button ID="Button3" runat="server" Height="21px" Text="Print" 
                      Width="82px" Font-Bold="True" onclick="Button3_Click" />
                   </td>
                    </tr>
                
                   <tr>
       <td colspan="2" align="center">
             </td> </tr>
              
                
                
                
                
                
                
                
                <td colspan="2" align="center">
                    <asp:MultiView ID="MultiView1" runat="server">
                        <asp:View ID="View1" runat="server">
                        <table style="height: 185px; width: 102%">
                        <tr>
                        <td align="center"> 
                 <asp:GridView ID="GridView1" runat="server" CellPadding="4" 
                        
                        ForeColor="#333333" GridLines="None">
                        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                        <FooterStyle BackColor="#5D7B9D" ForeColor="White" Font-Bold="True" />
                        <PagerStyle ForeColor="White" HorizontalAlign="Center" BackColor="#284775" />
                        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
                        <EditRowStyle BackColor="#999999" />
                        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
                   </asp:GridView>
                            <br />
                            <asp:Label ID="label" runat="server" Font-Bold="True" Font-Italic="True" 
                                Font-Size="Medium" ForeColor="#990000"></asp:Label>
                            <br />
                            <br />
                           
                            <asp:Button ID="Button2" runat="server" Text="Ok" onclick="Button2_Click" />
                           
                            </td>
                        </tr>
                        
                        </table>
                        </asp:View>
                    </asp:MultiView>
                    </td>
                                  
                
                </table>



if i select Cement i need to print the data from the cement table,then i select seed from dropdown table i need data from the seed table
Answers (1)
0
Jaganathan Bantheswaran
NA 21.9k 2.2m 11y
Provide some code. where you want to do this? At what stage you are now?

Meanwhile,

You can add properties dynamically in two ways,

1. using ExpandoObject

   var dynamicObject = new ExpandoObject();
   dynamicObject.YourPro1 = "Your Value 1";
   dynamicObject.YourPro1 = 1234;

2. using Dictionary

    public class MyClass
   {
       public string Template { get; set; }
       public string Term { get; set; }
       public Dictionary<string, string> Properties{ get; private set; }

      public MyClass()
      {
          Properties= new Dictionary<string, string>();
      }

      public void AddProperty(string key, string value)
      {
             Properties.Add(key, value);
      }
   }

    // to be used like this:
    MyClass instance = new MyClass();
    instance.AddProperty("Email", "test@example.com");
    instance.AddProperty("Phone", "976856734");

3. using Reflection Emit

    Please read here with Example.