Click here to Skip to main content
15,906,574 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want to show the result in gridview as like Datalist...
I achieved this by using Datalist as given below.... I need to do that task in Gridview .... Help me.... Give me an idea...

XML
<div>
       <asp:DataList ID="GV_Product" runat="server" CellSpacing="3" CellPadding="2" RepeatColumns="2" Width="200px" Height="200px">

      <ItemTemplate>

           <table>

           <tr>
               <td class="auto-style2" colspan="3" style="text-align: center; font-size: large">Product</td>
           </tr>
               <tr>
                   <td class="auto-style1" colspan="3" style="text-align: center; font-size:small" >
                       <asp:CheckBox ID="chk" runat="server" /></td>
               </tr>
           <tr>
               <td>Product Name </td>
               <td>
                   <asp:Label ID="lblPrdName" runat="server" Text='<%#Bind("P_Name") %>'></asp:Label></td>
               <td>&nbsp;</td>
           </tr>
           <tr>
               <td>Product Price </td>
               <td>
                   <asp:Label ID="lblPrdPrice" runat="server" Text='<%#Bind("P_Price") %>'></asp:Label></td>
           </tr>
           <tr>
               <td>Quantity               </td>
               <td>
                   <asp:TextBox ID="txt_Qty" runat="server" Enabled="false" AutoPostBack="true" ></asp:TextBox></td>
               <asp:RegularExpressionValidator ID="REV_Qty" runat="server" ErrorMessage="Provide the Qty in Correct Format" ControlToValidate="txt_Qty" ValidationExpression="^[0-9]+$"></asp:RegularExpressionValidator>

               <td>Total Quantity
                   <asp:Label ID="lblTotQty" runat="server" Text=""></asp:Label></td>
           </tr>
           <tr>
               <td>Amount</td>
               <td>
                   <asp:Label ID="lblTotal" runat="server" Text=""></asp:Label></td>
               <td>Total Amount
                   <asp:Label ID="lblTotAmt" runat="server" Text=""></asp:Label>
               </td>
           </tr>


               </table>
          </ItemTemplate>
            </asp:DataList>


   </div>
Posted

1 solution

Its beeter to use ListView control than Gridview in your case.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900