我用后台代码将绑定htmlText绑定到datalist里
  for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
    ds.Tables[0].Rows[i]["cj"] = "<input type='text' id='cj" + i.ToString() + "' runat=server Width='50px' onchange=cj('" + i.ToString() + "')>";
   ds.Tables[0].Rows[i]["pscj"] = "<input type='text' id='pscj" + i.ToString() + "' runat=server Width='50px' onchange=pscj('" + i.ToString() + "')>";
}
可是我用Findcontrol找不到。
HtmlInputText cj = (HtmlInputText)DataList1.FindControl("cj" + i.ToString());
HtmlInputText pscj = (HtmlInputText)DataList1.FindControl("pscj" + i.ToString());

解决方案 »

  1.   

    FindControl()方法定义是:Searches the current naming container for a server control with the specified id parameter.for a server control:   runat=server
      

  2.   

    html空间添加后页面上有显示嘛?
    以前我做过添加<asp:Button />控件,这些控件在页面刷新后会消失,需要重新创建一下
      

  3.   

    一句话,微软没实现查找HTML控件,所以找不到