在Gridview中显示结果,就像Datalist一样 [英] Show the result in Gridview as like Datalist

查看:97
本文介绍了在Gridview中显示结果,就像Datalist一样的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在gridview中显示结果,就像Datalist一样...

我通过使用Datalist实现了这一点,如下所示....我需要在Gridview中完成这个任务....帮助我....给我一个想法...



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...

<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>

推荐答案

> < / asp:RegularExpressionValidator >

< td > 总数量
< asp:标签 ID = lblTotQty runat = server < span class =code-attribute>文字 = > < / asp:Label > < / td >
< / tr >
< tr >
< td > 金额< / td >
< td >
< asp:标签 ID = lblTotal runat = 服务器 文字 = > < / asp:标签 > < / td >
< td > 总金额
< asp:标签 ID = lblTotAmt runat = server 文本 = > < / asp:标签 >
< / td >
< / tr >


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


< ; / div >
"></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>


在你的情况下,它使用ListView控件而不是Gridview。
Its beeter to use ListView control than Gridview in your case.


这篇关于在Gridview中显示结果,就像Datalist一样的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆