当前位置: 代码迷 >> ASP.NET >> 如何通过button 来更改Lable的值
  详细解决方案

如何通过button 来更改Lable的值

热度:2064   发布时间:2013-02-25 00:00:00.0
怎么通过button 来更改Lable的值
C# code
<asp:GridView ID="gvSelect" runat="server" AutoGenerateColumns="False"                                    DataKeyNames="Pro_Id" onrowdeleting="gvSelect_RowDeleting"                                    onrowdatabound="gvSelect_RowDataBound"                BackColor="LightGoldenrodYellow" BorderColor="Tan" BorderWidth="1px"                CellPadding="2" ForeColor="Black" GridLines="None" Width="1000px" AllowPaging="True"                                  AllowSorting="True" ClientIDMode="Static" PageIndex="0" PageSize="5"                                  onpageindexchanging="gvSelect_PageIndexChanging"                                  onrowediting="gvSelect_RowEditing"                                  onrowcreated="gvSelect_RowCreated" onrowcommand="gvSelect_RowCommand"                                  >                                   <AlternatingRowStyle BackColor="PaleGoldenrod" />                                   <Columns>                                        <asp:TemplateField HeaderText="图片">                                        <ItemTemplate>                                            <img src='img/<%# Eval("Pro_Image") %>' width="50" height="50" alt="" />                                        </ItemTemplate>                                        </asp:TemplateField>                                       <asp:BoundField DataField="Pro_Name" HeaderText="名称"                                            SortExpression="Pro_Name" />                                       <asp:BoundField DataField="Pro_Price" HeaderText="价格"                                            SortExpression="Pro_Price" DataFormatString="{0:f2}"/>                                        <asp:TemplateField HeaderText="数量">                                        <ItemTemplate>                                            <asp:Button ID="jian" CommandArgument='<%# Eval("Pro_Id") %>' CommandName="jian" runat="server" Text="-" />                                            <asp:Label ID="Num" runat="server" Text="1"></asp:Label>                                            <asp:Button ID="jia"  CommandArgument='<%# Eval("Pro_Id") %>' CommandName="jia" runat="server" Text="+" />                                        </ItemTemplate>                                        </asp:TemplateField>                                                                              <asp:CommandField ShowDeleteButton="True" DeleteText="取消" HeaderText="取消" />                                   </Columns>                                   <FooterStyle BackColor="Tan" />                                   <HeaderStyle BackColor="Tan" Font-Bold="True" />                                   <PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue"                                        HorizontalAlign="Center" />                                   <SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />                                   <SortedAscendingCellStyle BackColor="#FAFAE7" />                                   <SortedAscendingHeaderStyle BackColor="#DAC09E" />                                   <SortedDescendingCellStyle BackColor="#EDA612" />                                   <SortedDescendingHeaderStyle BackColor="#EDA612" />                                                            </asp:GridView>
  相关解决方案