---错误-----------------------------------------
编译器错误信息: CS0246: 找不到类型或命名空间名称“Container”(是否缺少 using 指令或程序集引用?)---.aspx文件-----------------------------------------<img name="" src="<%=xb_img(DataBinder.Eval(Container.DataItem,"m_sex"))%> ">---.aspx.cs文件----------------------------------------- //显示 男女头像
public string xb_img(string sex)
{
if (sex.Trim() == "男")
{
return "images/boy.gif";
}
else
{
return "images/girl.gif";
}
}
------------------------------------
<img name="" src="<%#Container.DataItem,"m_sex")%> ">这样是能得到值
<img name="" src="<%=xb_img("男">">
这样运行也是正确

解决方案 »

  1.   

    换成<%# xb_img(DataBinder.Eval(Container.DataItem,"m_sex")) %>试试.
      

  2.   

    <img name="" src="<%# xb_img(DataBinder.Eval(Container.DataItem,"m_sex"))%> ">"#"的问题
      

  3.   

    <img name="" src="<%# xb_img(DataBinder.Eval(Container.DataItem,"m_sex"))%> ">"#"的问题
      

  4.   

    <img name="" src="<%# xb_img(DataBinder.Eval(Container.DataItem,"m_sex"))%> ">这么做我也提示出错
    什么错我给忘了,下午回家把错 考过来再贴上忘了说一下,我用的是vs2002 呵呵!
      

  5.   

    去那个网站看看有没有
    http://www.obai.net/download/index.html
      

  6.   

    <img name="" src="<%# xb_img(DataBinder.Eval(Container.DataItem,"m_sex").ToString())%> ">加上ToString()
      

  7.   

    public int sortcount(int sortid)
    {
    string Connection=System.Configuration.ConfigurationSettings.AppSettings["ConnectionString"];
    SqlConnection con=new SqlConnection(Connection);
    SqlCommand cmd2=new SqlCommand("select count(sortid) from Info where sortid=52",con);
    try
    {
    int count=Convert.ToInt32(cmd2.ExecuteScalar());
    if (count>0)
    {
    return count;
    }
    }
    catch
    {

    } }我的是写这样,不过运行提示说
    webform1.sortcount(int);并非所有的代码路径都返回值,这个是怎么样解决呢?
      

  8.   

    编译器错误信息: CS1502: 与“jiaoyouwang.WebForm1.xb_img(string)”最匹配的重载方法具有一些无效参数 <img name="" src="<%#xb_img(DataBinder.Eval(Container.DataItem,"m_sex"))%>">
    create procedure member_guangmingbang_show
    asselect top 25 * from member,member_guangmingbang where  datediff(day,getdate(),dateadd(day,g_day_num,g_time))>=0 
    and member.m_id=member_guangmingbang.m_id and g_shenhe=1 order by newid() desc
    我回来了,这是我的错误 ,前台代码还有 我写的存储过程看看倒底是哪错了?