更新时间:2023-10-19 18:04:34
您需要为此使用OnRowCommand事件.
you need to use OnRowCommand event for that.
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
Width="180px" AutoGenerateEditButton="True"
OnRowCommand=GridView1_RowCommand
onselectedindexchanged="GridView1_SelectedIndexChanged">
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "sms":
{
//your code here...
break;
}
default:
break;
}
}
如果这对您有帮助,那么请投票并将其标记为答案
If this helped you then please Vote and mark it as answer
<%@ Page Language="C#" AutoEventWireup="true" EnableEventValidation="false" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<asp:Button ID="b1" runat="server" Text="sms" CommandName="sms" onclick="B1_Click" />
protected void B1_Click(object sender, EventArgs e)
{
Button1.Text = "santhu";
}