首页 新闻 会员 周边 捐助

ListView更新问题!

1
悬赏园豆:50 [待解决问题]
 <EditItemTemplate>
<tr>
<td style="width: 100px;text-align:center">
<asp:LinkButton CommandName="Update" ID="UpdateButton" Text="更新" runat="server" ValidationGroup="Update"/>&nbsp;&nbsp;&nbsp;&nbsp;
<asp:LinkButton CommandName="Cancel" ID="CancelButton" Text="取消" runat="server" ValidationGroup="Update" />&nbsp;&nbsp;&nbsp;&nbsp;
</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;
}
 
 
 一点更新就提示这个。。。。无法获取两个文本的值~!
至少一个参数没有被指定值。
问题补充: 但是可以正常获取ID的那个值。。。不解!
davis3747的主页 davis3747 | 初学一级 | 园豆:50
提问于:2011-04-02 19:52
< >
分享
所有回答(2)
0

你有没有用数据源控件?

青牛客 | 园豆:562 (小虾三级) | 2011-04-04 17:03
0

要不,把你的项目放上来,瞧瞧,俺运行下。。

wlz0815 | 园豆:587 (小虾三级) | 2011-04-08 11:05
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册