【发布时间】:2018-08-30 12:42:17
【问题描述】:
以下是我的C#代码和aspx代码。此代码假设更新页面上的网格,但是当我单击保存时,它不会传递在评论框中输入的值并更新。
protected void btnSaveComments_Click(object sender, EventArgs e)
{
if (txtRowIndex.Value != string.Empty)
{
int gridViewRowIndex = Convert.ToInt32(txtRowIndex.Value);
txtFlaggedComments.Text = txtFlaggedComments.Text.Replace("'", "`");
gvSalesmanLicenseList.Rows[gridViewRowIndex].Cells[14].Text = trimComment(txtFlaggedComments.Text, 15);
gvSalesmanLicenseList.Rows[gridViewRowIndex].Cells[14].ToolTip = txtFlaggedComments.Text;
gvSalesmanLicenseList.Rows[gridViewRowIndex].Cells[18].Text = txtFlaggedComments.Text;
gvSalesmanLicenseList.Rows[gridViewRowIndex].Cells[14].ToolTip.Replace("'", "''");
LinkButton lblEditComments = (LinkButton)gvSalesmanLicenseList.Rows[gridViewRowIndex].FindControl("lbEditComments");
lblEditComments.Attributes.Add("onclick", "ShowMyModalPopup('" + gvSalesmanLicenseList.Rows[gridViewRowIndex].RowIndex + "','" + txtFlaggedComments.Text + "')");
UpdatePanel1.Update();
}
}
还有 HTML:
<td style="vertical-align: middle; width: 154px; height: 22px; text-align: right"
valign="middle" align="right">
<asp:Button ID="btnPrintSalesmanContinue"OnClick="btnPrintSalesmanContinue_Click"
runat="server" Text="Submit" __designer:wfdid="w110" CausesValidation="false"
UseSubmitBehavior="False></asp:Button>
</td>
【问题讨论】: