<FooterTemplate><a href ="../PostList.aspx?id=<%#Eval("TypeId") %>">>更多</a></FooterTemplate>
这个是在DataList的页脚模板里写的一个绑定。select top 10 PostId,Title,P_Date,UserName,TypeName,Post.TypeId from Post,Type where Post.TypeId=Type.TypeId  and Post.TypeId=1 order by  Post.L_Date desc这个是我们的一个查询语句在运行的时候,PostList.aspx?id=  后面获取不到值。而使用这个查询语句在查询分析器里执行后的结果中有TypeId这一列,里面也有值的。不知道为什么这里显示不出来。请大家指教.

解决方案 »

  1.   

    <%#Eval("TypeId") %>">>  这里面绑定的TypeId是属性,不是字段名,你那个属性名可能写错了,检查一下
      

  2.   

    <a href ='../PostList.aspx?id= <%#Eval("TypeId") %>'>更多 </a> 
      

  3.   

    <a href="#" onclick ="window.open(test.aspx?ID=<%# Eval("ID") %>');javascript:return false"></a>
      

  4.   

    <FooterTemplate> <a href ="../PostList.aspx?id= <%#Eval("Post.TypeId ") %>">>更多 </a> </FooterTemplate> 
    这样写试试或者查询这样写 select top 10 PostId,Title,P_Date,UserName,TypeName,Post.TypeId as TypeId  from Post,Type where Post.TypeId=Type.TypeId  and Post.TypeId=1 order by  Post.L_Date desc 如果还不行,就跟下断点,看看那个查询返回的ds的列的值是多少...
      

  5.   

    <%#Eval("属性")%>你绑定的是数据库字段..要绑定你model里面的属性...
      

  6.   

    目前三层架构不是太熟练,所以,没有建专门的Model   这里绑定的,应该就是DataSet中TypeId 这一列的值。
      

  7.   

    很显然
    Eval("属性").ToString()才行``不然不是一个值类型
      

  8.   

    这个功能,我做的很简单,直接使用查询语句返回一个DataSet 然后,直接绑定上了。  没有做其它的复杂的东西。select top 10 PostId,Title,P_Date,UserName,TypeName,Post.TypeId as TypeId from Post,Type where Post.TypeId=Type.TypeId  and Post.TypeId=1 order by  Post.L_Date desc 中Post.TypeId  我也曾换成Post.TypeId as TypeId  也不行的我使用的查询语句在查询分析器里得到的查询结果上面的那个列名就是TypeId 不知道为什么绑定上去,没效果。