实现点击Button后隐藏Button显示Label并获得shoppingcarid
--------------------编程问答--------------------
--前台改一点
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" OnRowCommand="GridView1_RowCommand"...
<asp:Button ID="ButIsPay" runat="server" Text=" 确认付款" CommandName="Pay" />
--后台
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "Pay")
{
//处理你要处理的事
Button ButIsPay = e.CommandSource as Button;
Label LabIsPay = ButIsPay.Parent.FindControl("LabIsPay") as Label;
ButIsPay.Visible = false;
LabIsPay.Visible = true;
}
}
--------------------编程问答--------------------
怎么获得shoppingcarid啊 现在主要要求获得shoppingcarid
--------------------编程问答--------------------
并且使用1楼你的方法之后报错误“GridView1_RowCommand”的重载均与委托“System.Web.UI.WebControls.GridViewCancelEditEventHandler”不匹配 F:\Visual Studio 2010\测试1\User\ShoppingCar.aspx
补充:.NET技术 , C#