Gridview rowdatabound access data items vb

后端 未结 2 1345
花落未央
花落未央 2021-01-25 23:45

I am trying to an ImageUrl to an image in a Template Field in GridView but keep getting the error:

Object reference not set to an instance of an object. on this line:

2条回答
  •  野趣味
    野趣味 (楼主)
    2021-01-26 00:33

    try

    Dim imagePath As String = e.rowView("image_path").ToString()
    

    If the table binded with the grid has column "image_path", then instead use an easier way....

    If you want to build some custome string

    imageurl = '<%# String.Format("{0} - {1} - {2} - {3}", Eval("Name1"), Eval("Name2"), Session["abc"],Request["abc"]) %>'
    

提交回复
热议问题