protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
{
if (e.CommandName == "upd")
{
string id = e.CommandArgument.ToString();
TextBox hh = (TextBox)e.Item.FindControl("num");
string ss = hh.Text;
new AcomLb.BLL.ShProduct().updateProduct(id, hh.Text);
bind();
}
}我代码是这样写的 但是每次取到的值都是他本身的文本框的值 而不是我修改过的
(做这个是修改下数量 但是取值的时候取到的是他的原来的值 而不是我修改后的文本框的值)
{
if (e.CommandName == "upd")
{
string id = e.CommandArgument.ToString();
TextBox hh = (TextBox)e.Item.FindControl("num");
string ss = hh.Text;
new AcomLb.BLL.ShProduct().updateProduct(id, hh.Text);
bind();
}
}我代码是这样写的 但是每次取到的值都是他本身的文本框的值 而不是我修改过的
(做这个是修改下数量 但是取值的时候取到的是他的原来的值 而不是我修改后的文本框的值)
{
绑定Repeater1数据
}
楼上的意思是 绑定是否写在了 (!IsPostBack)里面!
例如不repeater里是label,ID=upd,可这样写
for(int i=0;i<Repeater1.Items.count;i++)
{
label lb=(label)Repeater1.Items[i].FindControl("upd");
TextBox hh = (TextBox)Repeater1.Items[i].FindControl("num");
hh.text=lb.text;
}
CommandArgument这个里面写的什么?
CommandArgument='<%# Container.ItemIndex %>'是这个?