<EditItemTemplate>
<tr>
<td style="width: 100px;text-align:center">
<asp:LinkButton CommandName="Update" ID="UpdateButton" Text="更新" runat="server" ValidationGroup="Update"/>
<asp:LinkButton CommandName="Cancel" ID="CancelButton" Text="取消" runat="server" ValidationGroup="Update" />
</td>
<td style="width: 200px; text-align:center">
<asp:Label Text='<%#DataBinder.Eval(Container.DataItem,"ID")%>' ID="Lbid" runat="server" />
<asp:TextBox ID="DcgnameTextBoxup" runat="server" Text='<%# Bind("Bigtype_zh") %>' />
<asp:RequiredFieldValidator ID="rfvup1" runat="server" ErrorMessage="不能为空" ValidationGroup="Update"
ControlToValidate="DcgnameTextBoxup" SetFocusOnError="true"></asp:RequiredFieldValidator>
</td>
<td style="width: 200px; text-align:center">
<asp:TextBox ID="en_DcgnameTextBoxup" runat="server"
Text='<%# Bind("Bigtype_en") %>' />
<asp:RequiredFieldValidator ID="rfvup2" runat="server" ErrorMessage="不能为空" ValidationGroup="Update"
ControlToValidate="en_DcgnameTextBoxup" SetFocusOnError="true"></asp:RequiredFieldValidator>
</td>
</tr>
</EditItemTemplate>
protected void LvProType_ItemUpdating(object sender, ListViewUpdateEventArgs e)
{
ListViewItem item = LvProType.Items[e.ItemIndex];
Label lb = (Label)item.FindControl("Lbid");
TextBox tbcn = (TextBox)item.FindControl("DcgnameTextBoxup");
TextBox tben = (TextBox)item.FindControl("en_DcgnameTextBoxup");
string upsql = "UPDATE [Bigtype] SET [Bigtype_zh]=" + tbcn.Text.Trim() + ", [Bigtype_en]=" + tben.Text.Trim() + " WHERE [ID] = " + lb.Text.Trim() + "";
OleDbConnection conn = new OleDbConnection(System.Configuration.ConfigurationManager.ConnectionStrings["TopDB"].ToString());
conn.Open();
OleDbCommand cmd = new OleDbCommand(upsql, conn);
cmd.ExecuteNonQuery();
conn.Close();
LvProType.EditIndex = -1;
GetBigtype();
lbmsg.Text = "修改成功";
lbmsg.Visible = true;
}
一点更新就提示这个。。。。无法获取两个文本的值~!
至少一个参数没有被指定值。
你有没有用数据源控件?
要不,把你的项目放上来,瞧瞧,俺运行下。。