Jump to content
Xtreme .Net Talk

Very Urgent....Plz. Help... Display image in Datagrid Column


Recommended Posts

Posted (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 by Brijesh81
Posted

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

  • 2 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...