Brijesh81 Posted July 17, 2003 Posted July 17, 2003 (edited) Very Urgent....Plz. Help... Display image in Datagrid Column using Server side code I need to display images in Datagrid Column. I am using the following code.... but it gives problems...Plz. help... DataGrid dgProds = new DataGrid(); TemplateColumn dgColHidden = new TemplateColumn(); System.Web.UI.WebControls.Image imgNoDisplay = new System.Web.UI.WebControls.Image(); imgNoDisplay.ImageUrl = "../Images/nodisplay.gif"; dgColHidden.ItemTemplate = new TemplateControl; dgColHidden.ItemTemplate.InstantiateIn(imgNoDisplay); **above line gives run time error... because object dgColHidden.ItemTemplate is not instantiated...I don't know, how to instantiate the object of this type***** dgProds.Columns.Add(dgColHidden); Edited July 17, 2003 by Brijesh81 Quote
Brijesh81 Posted July 17, 2003 Author Posted July 17, 2003 I have solved my problem..... Thanks.. Brijesh Quote
anand Posted July 19, 2003 Posted July 19, 2003 Hi Brijesh Can u pls tell me why u got that error and whats the solution for that?? Thanks Satya gummadi009@yahoo.com Quote Satya
Brijesh81 Posted July 22, 2003 Author Posted July 22, 2003 Hi Satya, I couldn't find the soln to that problem. I changed the way, I was approaching it. I used dgProds.ItemsArray.Items[j].Controls.Add to insert the image control in the Column j of the row no i of the grid dgProds. Brijesh Quote
wichawd Posted October 1, 2003 Posted October 1, 2003 Can you give me a VB.Net version of the code you used? Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.