我的.aspx设计源代码是
<asp:GridView ID="grdPaymentStatus" runat="server"
AutoGenerateColumns="false"
CssClass="table table-responsive table-striped table-bordered table-advance table-hover"
HeaderStyle-CssClass="ProjectStatusHeader"
OnRowDataBound="grdPaymentStatus_RowDataBound" >
<Columns>
<asp:BoundField DataField="instCount" HeaderText="Installments" HeaderStyle-BackColor="#dddddd" HeaderStyle-Font-Bold="false" />
<asp:BoundField DataField="instPayment" HeaderText="Amount" HeaderStyle-BackColor="#dddddd" HeaderStyle-Font-Bold="false" />
<asp:BoundField DataField="instWord" HeaderText="Words" HeaderStyle-BackColor="#dddddd" HeaderStyle-Font-Bold="false" />
<asp:BoundField DataField="instPaymentMode" HeaderText="Payment Mode" HeaderStyle-BackColor="#dddddd" HeaderStyle-Font-Bold="false" />
<asp:BoundField DataField="instPaymentdat" HeaderText="Payment Done On" HeaderStyle-BackColor="#dddddd" HeaderStyle-Font-Bold="false" />
<asp:BoundField DataField="instIspaid" HeaderText="Payment Status" HeaderStyle-BackColor="#dddddd" HeaderStyle-Font-Bold="false" />
</Columns>
</asp:GridView>
.aspx.cs代码是
protected void grdPaymentStatus_RowDataBound(Object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.Cells[2].Text != "Paid")
{
Button sendRequestButton = new Button();
sendRequestButton.ID = "PaymentRequest" + Row.Cells[0].Text;
sendRequestButton.Text = "Send Request";
sendRequestButton.CssClass = "btn blue";
sendRequestButton.UseSubmitBehavior = false;
sendRequestButton.CausesValidation = false;
sendRequestButton.Click += new EventHandler(sendRequestButton_OnClick);
e.Row.Cells[2].Controls.Add(sendRequestButton);
}
}
}
protected void sendRequestButton_OnClick(object sender, EventArgs e)
{
if (!string.IsNullOrEmpty(AckNo))
BindDetailsPayment(AckNo);
}
数据在(!isPostback)方法中的页面加载时绑定,每当我尝试单击gridview中添加的按钮时,按钮单击事件(sendRequestButton_OnClick)未触发
请帮帮我
提前感谢.....