日期:2014-05-17  浏览次数:20556 次

怎么通过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" />