Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Refrence image in template column

Reply
Thread Tools

Refrence image in template column

 
 
David A. Coursey
Guest
Posts: n/a
 
      10-04-2004
I am trying to change the image in my column depending on the status of the
db field. All of the data is being populated correctly, I just haven't been
able to get the image path to work.

aspx page:

<asp:boundcolumn visible="False" datafield="success" />
<asp:templatecolumn headertext="Status" >
<itemtemplate>
<asp:image id="imgWebStatus" runat="server" imageurl="" />
</itemtemplate>
</asp:templatecolumn>



aspx.cs codebehind page:


if(e.Item.ItemType.Equals(System.Web.UI.WebControl s.ListItemType.Item) ||
e.Item.ItemType.Equals(System.Web.UI.WebControls.L istItemType.AlternatingItem))
{
switch(Convert.ToInt32(e.Item.Cells[0].Text))
{
case 0:
{
e.Item.Cells[1].WHAT_GOES_HERE = Request.ApplicationPath +
"/images/no.gif";
break;
}



Thanks for looking.

David A. Coursey


 
Reply With Quote
 
 
 
 
Michael Tkachev
Guest
Posts: n/a
 
      10-06-2004
Image i = (Image)e.Item.Cells[1].Controls[0];
i.ImageUrl = yourPath;

"David A. Coursey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I am trying to change the image in my column depending on the status of

the
> db field. All of the data is being populated correctly, I just haven't

been
> able to get the image path to work.
>
> aspx page:
>
> <asp:boundcolumn visible="False" datafield="success" />
> <asp:templatecolumn headertext="Status" >
> <itemtemplate>
> <asp:image id="imgWebStatus" runat="server" imageurl="" />
> </itemtemplate>
> </asp:templatecolumn>
>
>
>
> aspx.cs codebehind page:
>
>
> if(e.Item.ItemType.Equals(System.Web.UI.WebControl s.ListItemType.Item) ||
>

e.Item.ItemType.Equals(System.Web.UI.WebControls.L istItemType.AlternatingIte
m))
> {
> switch(Convert.ToInt32(e.Item.Cells[0].Text))
> {
> case 0:
> {
> e.Item.Cells[1].WHAT_GOES_HERE = Request.ApplicationPath +
> "/images/no.gif";
> break;
> }
>
>
>
> Thanks for looking.
>
> David A. Coursey
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Refrence image in datagrid with OnItemDataBound David A. Coursey ASP .Net Web Controls 1 10-05-2004 11:30 PM
Group Policy refrence Rich MCSE 48 07-28-2004 09:39 PM
Self refrence to class type in template Greg Phillips C++ 1 05-25-2004 11:53 PM
Re: How to refrence html objec t from aspx form Kevin Spencer ASP .Net 0 06-30-2003 02:28 PM
How can I refrence html object from aspx form. Mike John ASP .Net 1 06-29-2003 12:45 AM



Advertisments