日期:2014-05-20  浏览次数:21112 次

未能在 ControlParameter“ ”中找到控件
本帖最后由 Errol1017 于 2010-10-09 11:35:54 编辑 我用一个listview控件和一个formview控件创建master/detail表单,datakeynames="id",

<asp:ListView ID="ListView1" runat="server" DataSourceID="SqlDataSource1" DataKeyNames="id">

<asp:FormView ID="FormView1" runat="server" DataSourceID="SqlDataSource2">

<asp:SqlDataSource ID="SqlDataSource2" runat="server" SelectCommand="SELECT * FROM [school] WHERE id=@id">
    <SelectParameters>
        <asp:ControlParameter ControlID="ListView1" Name="id" />
    </SelectParameters>
</asp:SqlDataSource>

出现问题,未能在 ControlParameter“id”中找到控件“ListView1”。
上网查了,解决方法是把listview1换成该控件的uniqueID,但我不会用断点查看uniqueID,不会用,
然后我恢复到上一次成功运行,查看网页的源代码,其中有ctl00_ContentPlaceHolder1_ListView1,我猜想这个可能是uniqueID,换进去试了,还是错误
求教高手,怎么查看uniqueID属性?还有没有别的解决办法?
------解决方案--------------------
有没有人帮帮忙。。。
------解决方案--------------------
呼呼,搞定
------解决方案--------------------
无满意结帖不太好,再问个问题。。
protected void LinkButton1(object sender, EventArgs e)
{
  SqlDataSource1t.SelectCommand = "SELECT * FROM school WHER id=@LinkButton1.Text";
}
请问这样的效果,该怎么写代码?上面那样是不行。 
------解决方案--------------------
引用:
呼呼,搞定

请问您是怎么搞定的、我是一个菜鸟、也遇到了同样的问题