c# - gridview, how to build a image url in code behind? -
i have gridview control contains image field. however, image url built several fields in returned dataset. how concatenate fields together, , @ point do can pass image url imagefield in gridview? guessing it's on rowdatabound don't know how access each of rows in dataset?
thanks.
i'm not sure trying concatenate without code example, perform concatenation before binding gridview , store in private member on class can access later in rowdatabound event.
you can use row data bound event find control within row , set imageurl
property.
private string m_concaturl; protected void gridview_rowdatabound(object sender, gridviewroweventargs args) { if(args.row.rowtype == datacontrolrowtype.datarow) { image imgctrl = (image) args.row.findcontrol("imgctrl"); imgctrl.imageurl = m_concaturl; } }
Comments
Post a Comment