日期:2014-05-18  浏览次数:20433 次

求助,如何给动态生成的图片控件做链接??
绑定数据函数
(1)
private   void   BindFileDown()
{
      for(...)
      {
          ds.Tables[0].Rows[i][ "PictureName "]   =   " <a   title= ' "   +   FileSize   +   " '   href= '# '   onclick=\ "javascript:popWindows( '../../DLPicture.aspx? "   +   Constant.Query_DownloadRefNum   +   "= "   +   ds.Tables[0].Rows[i][ "DocID "].ToString()   +   " ')\ "> <img   width=80   height=60   border=0   src= '../../DLPicture.aspx? "   +   Constant.Query_DownloadRefNum   +   "= "   +   ds.Tables[0].Rows[i][ "DocID "].ToString()   +   " '   /> </a> ";       ---> 这行读取图片到img   在链接图片,点击可以打开图片        
      }
  A.DataSource   =   ds;
  A.DataBind();
}

若是这样图片能正常读出.

(2)
private   void   A_ItemDataBound(...)
{
     
e.Item.Cells[9].Text   =   " <div   id=Confid "   +   key   +   "   > "   +   e.Item.Cells[9].Text   +   " </div> "   +   tempDdl;
       
            ....    
        HtmlInputFile   Picture=new   HtmlInputFile();//Picture
        Picture.Style.Add( "display ", "none ");
        Picture.Style.Add( "width ", "150 ");
        Picture.ID= "Picture "   +   key;
        e.Item.Cells[12].Controls.Add(Picture);   --> 想实现当点更改时,可以更改图片,但增加这几句后,图片就不能读取,DataGrid的PictureName列为空,为何会是这样?
前面不是梆定了吗?
}

(3)
    private   void   A_ItemDataBound(...)
    {
            ...
            也可在这重新读图片
    HtmlImage   im=new     HtmlImage();
    im.Style.Add( "width ", "80 ");
    im.Style.Add( "height ", "60 ");
    im.Style.Add( "border ", "0 ");
    im.Src= "../../DLPicture.aspx? "   +   Constant.Query_DownloadRefNum   +   "= "   +       ds.Tables[0].Rows[e.Item.ItemIndex][ "DocID "].ToString();
    e.Item.Cells[12].Controls.Add(im);//add

    但我怎样对im图片控件   做链接??        
    " <a   title= ' "   +   FileSize   +   " '   href= '# '   onclick=\ "javascript:popWindows( '../../DLPicture.aspx? "   +   Constant.Query_DownloadRefNum   +   "= "   +   ds.Tables[0].Rows[i][ "DocID "].ToString()   +   " ')\ ">   这句怎样加上去?

    }
麻烦各位达人,出出策,谢谢~~


------解决方案--------------------
把添加图片那里修改,Lable Lb = new Lable();
Lb.Text = " <a title= ' " + FileSize + " ' href= '# ' onclick=\ "javascript:popWindows( '../../DLPicture.aspx?