adp.Fill(ds,"photo");
if(ds1.Tables[0].Rows[0]["photo"] == null)
{
   ...
}
this.Repeater.DataSource = ds.Tables["photo"].DefaultView;photo字段存放的为图片路径,我想判断如果没有图片路径就用img/wutu.gif的路径填充,然后绑定到repeater如何做?photo表内不止一条记录

解决方案 »

  1.   

    up  或者在<%# DataBinder.Eval(Container.DataItem,"photo") %>  这里如何判断?
      

  2.   

    adp.Fill(ds,"photo");
    DataRowCollection DrC = ds.Table[0].Rows;
    foreach(DataRow dr in DrC)
    {
          if(dr["photo"]==null)
              dr["photo"]="img/wutu.gif";
       ...
    }
    this.Repeater.DataSource = ds.Tables["photo"].DefaultView;试一下。
      

  3.   

    if(dr["photo"] == null || dr["photo"].ToString() == String.Empty)
     ......
    ds.AcceptChanges();
      

  4.   

    adp.Fill(ds,"photo");
    DataRowCollection DrC = ds.Tables[0].Rows;
    foreach(DataRow dr in DrC)
    {
             if(dr["photo"] == null || dr["photo"].ToString() == String.Empty)
    dr["photo"]="img/wut.gif";
    }
    this.Repeater.DataSource = ds.Tables["photo"].DefaultView;这么写的,不行啊
      

  5.   

    你不是绑定到repeater上吗,不用改table的值,前台改为<%# 命名空间.方法(DataBinder.Eval(Container.DataItem,"photo").ToString()) %>方法自己写,很简单
      

  6.   

    前一段我用APS.NET作了一个基于拉技术的聊天室,后来想在其中增加点游戏内容,感觉到基于拉技术的响应实时性不好,所以想改为基于拉技术的。
        现已作了尝试,代码如下:// Content.aspx.cs ///////////////////////////////////////////////////////
    public class Content : System.Web.UI.Page
    {
    private void Page_Load(object sender, System.EventArgs e)
    {
    Session.Timeout = 60;
    Response.Write("欢迎 . . .<br>\n");
    Response.Flush();
    Application[Session.SessionID] = Response;
    System.Threading.Thread.Sleep(System.Threading.Timeout.Infinite);
    }
    }
    // Send.aspx.cs //////////////////////////////////////////////////////////
    public class Send : System.Web.UI.Page
    {
    protected System.Web.UI.WebControls.Button ButtonSend;
    protected System.Web.UI.WebControls.TextBox TextBox1;

    private void ButtonSend_Click(object sender, System.EventArgs e)
    {
    foreach(string name in Application.AllKeys)
    {
    HttpResponse Response = Application[name] as HttpResponse;
    if(Response!=null && Response.IsClientConnected)
    {
    Response.Write(TextBox1.Text + "<br>\n");
    Response.Flush();
    }
    else
    {
    Application.Remove(name);
    }
    }
    }
    }    可以聊天,但发现一大问题:同时连接的用户被限制在50个左右,再多的就连不上了,并且会导致其他用户也陷于停滞状态。
        请高手答疑解惑,还可另开贴给分!