repeater里的控件怎么用。。 比如有个textbox1。。代码里面找不到textbox1 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 //FindControlprotected void repeter_ItemCommand(object source, RepeaterCommandEventArgs e) { e.Item.FindControl("testbox1"); } foreach( RepeaterItem item in this.Repeater1.Items ) {TextBox txt=item.FindControl("TextBox1") as TextBox; if(txt!=null){}} protected void Repeater_ItemDataBound(object obj, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {TextBox txt=e.item.FindControl("TextBox1") as TextBox; DataRowView row = (DataRowView)e.Item.DataItem; }} 这里已经写得比较全了,如果你用的是c#里面就不能用as 要这样:TextBox tb=(TextBox)item.FintControl("TextBox1"); 调用FindControl(control's ID)方法 int delId = 0; //先遍历取得选中项 for (int i = 0; i < this.repeater1.Items.Count; i++) { CheckBox cbx = (CheckBox)repeater1.Items[i].FindControl("cbx"); Label lbl = (Label)repeater1.Items[i].FindControl("lbl"); if (cbx != null) { if (cbx.Checked) { delId = Int32.Parse(lbl.Text); PxgzBLLS pxbll = new PxgzBLLS(); pxbll.deletesAll(delId); bind(); } } } 急......面试题,高分,马上结..... .net 删除图片,麻烦高手帮看一下 asp.net 新手请问:像很多网站要注册登录才能进入论坛。用ASP.NET怎么实现的? 问一个利用javascript提交表单的简单问题,解决立即结分 给父控件赋值问题? 如何在ASPX中添加CommanDialog组件? 新上的服务器 老是提示.tmp文件不是有效 WIN32 资源文件 求救 两个aspx文件之间的传值问题,请高手们帮忙,谢谢了. SmtpMail.Send 问题 字符串截取问题 用多行文本框录入的数据,显示在lable中,怎样保持原格式不变?
//FindControl
protected void repeter_ItemCommand(object source, RepeaterCommandEventArgs e)
{
e.Item.FindControl("testbox1");
}
{
TextBox txt=item.FindControl("TextBox1") as TextBox;
if(txt!=null){}
} protected void Repeater_ItemDataBound(object obj, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{TextBox txt=e.item.FindControl("TextBox1") as TextBox;
DataRowView row = (DataRowView)e.Item.DataItem;
}
}
这里已经写得比较全了,如果你用的是c#
里面就不能用as
要这样:TextBox tb=(TextBox)item.FintControl("TextBox1");
//先遍历取得选中项
for (int i = 0; i < this.repeater1.Items.Count; i++)
{
CheckBox cbx = (CheckBox)repeater1.Items[i].FindControl("cbx");
Label lbl = (Label)repeater1.Items[i].FindControl("lbl");
if (cbx != null)
{
if (cbx.Checked)
{
delId = Int32.Parse(lbl.Text);
PxgzBLLS pxbll = new PxgzBLLS();
pxbll.deletesAll(delId);
bind();
}
}
}