我使用GridView以可编辑格式显示某些数据。但是当我编辑GridView行时,我没有获得可编辑文本框的值。我再次得到旧的价值。请任何人给出一些建议。 在此先感谢...
Aspx代码:
var Animal = {
speak() {
console.log(this.name + ' makes a noise.');
}
};
class Dog {
constructor(name) {
this.name = name;
}
}
// If you do not do this you will get a TypeError when you invoke speak
Object.setPrototypeOf(Dog.prototype, Animal);
var d = new Dog('Mitzie');
d.speak(); // Mitzie makes a noise.
C#代码:
<asp:GridView ID="grdAppSetting" AutoGenerateEditButton="true" AutoGenerateDeleteButton="true" HeaderStyle-BackColor="#1abc9c" HeaderStyle-ForeColor="White" CssClass="t-transform m-t-30" HeaderStyle-BorderWidth="5px"
runat="server" OnRowCancelingEdit="grdAppSetting_RowCancelingEdit1" OnRowDeleting="grdAppSetting_RowDeleting" OnRowUpdating="grdAppSetting_RowUpdating"
OnRowEditing="grdAppSetting_RowEditing" AutoGenerateColumns="false" BorderColor="#1abc9c">
<Columns>
<asp:BoundField DataField="Key Name" HeaderText="Key Name" ReadOnly="true" ItemStyle-CssClass="p-l-10" ItemStyle-Width="100" />
<asp:BoundField DataField="Value" HeaderText="Value" ItemStyle-Height="40px" ItemStyle-Width="50%" ItemStyle-CssClass="p-l-10" ControlStyle-CssClass="form-control" />
</Columns>
</asp:GridView>
以下行中出现问题,
protected void grdAppSetting_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string Value = ((grdAppSetting.Rows[e.RowIndex].Cells[2].Controls[0]) as TextBox).Text;
string KeyName = grdAppSetting.Rows[e.RowIndex].Cells[1].Text;
if (appSettingsSection != null)
{
appSettingsSection.Settings[KeyName].Value = Value;
configuration.Save();
}
grdAppSetting.EditIndex = -1;
BindAppSettingGrid();
}
获取可编辑的文本框值是否正确???