如何在网格视图的最后一行最后一列添加按钮 [英] How to add button in last row last column in grid view

查看:83
本文介绍了如何在网格视图的最后一行最后一列添加按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实际上我正在使用网格视图,因为它检索总和文本框和下拉列表详细信息我计划在最后一行的最后一列添加一个按钮



< b>我尝试了什么:



actually i'am using grid view in that it head retrieve sum textboxs and dropdownlists details i planing to add one button at last of the row last column

What I have tried:

<asp:TemplateField HeaderText="save"

                    <ItemTemplate>
                   < FooterStyle HorizontalAlign="Right" VerticalAlign="Bottom"                     FooterTemplate >
                 <       asp:Button ID="Button1" runat="server" Text="save" >
                   < FooterTemplate > 
                  <ItemTemplate>
             <  asp:TemplateField >





我们尝试这个,但保存按钮是在最后一列的每一行添加。

请给我提示



i'am trying this but the save button is add on every row off the last column.
please give me hints

推荐答案

试试这个



try this

<asp:GridView ID="GridView1" runat="server" ShowFooter="true" AutoGenerateColumns="false">
           <Columns>
               <asp:BoundField DataField="itemname" HeaderText="itemname" />
               <asp:BoundField DataField="itemprice" HeaderText="itemprice" />
               <asp:BoundField DataField="quantity" HeaderText="quantity" />
               <asp:BoundField DataField="tax" HeaderText="tax" />
               <asp:TemplateField  HeaderText="finalamount">
                   <ItemTemplate>
                       <asp:Label  Text='<%# Eval("finalamount") %>' runat="server" />
                   </ItemTemplate>
                   <FooterTemplate>
                       <asp:Button Text="Save" runat="server" />
                   </FooterTemplate>
               </asp:TemplateField>
           </Columns>
       </asp:GridView>


Any您在页脚中添加的控件将仅在页脚中显示。你做得不好。

这是非常基本的事情。您需要阅读一些教程文档。



从GridView的页脚插入一条新记录(C#) ASP.NET站点 [ ^ ]



在Gridview中使用页脚模板。 - DotNetFunda.com [ ^ ]



在GridView的页脚中显示摘要信息(VB) ASP.NET站点 [ ^ ]









Any control you add in footer will show in footer only. You are not doing it properly.
This is very basic thing. You need to go through some tutorial documents.

Inserting a New Record from the GridView's Footer (C#) | The ASP.NET Site[^]

Working with Footer Template in Gridview. - DotNetFunda.com[^]

Displaying Summary Information in the GridView's Footer (VB) | The ASP.NET Site[^]




<asp:TemplateField HeaderText="Your header text">
                        <ItemTemplate>
                         <!-- your template control -->
                        </ItemTemplate>                       

                        <FooterTemplate>
                           <asp:Button ID="Button1" runat="server" Text="save" />
                        </FooterTemplate>
                    </asp:TemplateField>


如何计算时间列..就像我们有2列datetime我想在第3列中乘以两列值...如何这样做?
How to calculate time column .. Like if we have 2 column of datetime i want to multiply both columns value in 3rd column...How to do it?


这篇关于如何在网格视图的最后一行最后一列添加按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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