1

我有一个自动生成列的Gridview...问题是,数据类型都是imageurl。

当 gridview 填充时,url 是标签格式。

我可以将它们定义为有效的模板字段,但要求是自动生成。

我在 MSDN 上读到了这个,但我不知道如何从那里开始

private void BUChecker_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
{
}
4

2 回答 2

0

我认为你使用RowDataBound如下如果你不想使用模板字段

protected void RowDataBound(Object sender, GridViewRowEventArgs e)
{
    if(e.Row.RowType == DataControlRowType.DataRow)
    {
        //find your cell suppose it is Cell 0
       string imgUrl=e.Row.Cells[0].Text;
       Image img = new Imge();
       img.ImageUrl =imgUrl;
       e.Row.Cells[0].Controls.Add(img);

    }
}
于 2013-04-16T04:53:27.283 回答
0

你可以在它的TemplateFields. 见GridView控制'。请参阅供您参考。

于 2013-04-16T02:42:54.010 回答