473,386 Members | 1,817 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help with this

Hi,
I am trying to add images to a column based on the result of another column.
I created a template column and using a code-behind function

this is part of my html for the grid

<asp:BoundColumn DataField="status" ReadOnly="True" HeaderText="Status">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Map!">
<HeaderStyle horizontalalign="Center"
verticalalign="Middle"></HeaderStyle>
<ItemStyle horizontalalign="Center"></ItemStyle>
<ItemTemplate>
<img src='<%#getImage(Container.DataItem("status"))%>'/>
</ItemTemplate>
</asp:TemplateColumn>
This is my function

Protected Function getImage(ByVal dField As Object) As String

Select Case dField

Case "Accepted"

Return "images\approve.png"

Case "Rejected"

Return "images\deny.png"

End Select

End Function

I even tried this in my HTML also but didn't work
<asp:Image id="img" Runat="Server"
ImageUrl='<%#getImage(Container.DataItem("status") )%>'/>

any ideas?

Nov 19 '05 #1
4 1676
Please provide an error message!

....it might be that you in the function, asume that the argument you send
in, is a string. What if you are getting DBNull? Then the Select Case won't
work.

But since you are not providing the error message I might be on the wrong
path here...

Best Regards/
Lars Netzel

"Chris" <Ch***@discussions.microsoft.com> skrev i meddelandet
news:EF**********************************@microsof t.com...
Hi,
I am trying to add images to a column based on the result of another
column.
I created a template column and using a code-behind function

this is part of my html for the grid

<asp:BoundColumn DataField="status" ReadOnly="True" HeaderText="Status">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Map!">
<HeaderStyle horizontalalign="Center"
verticalalign="Middle"></HeaderStyle>
<ItemStyle horizontalalign="Center"></ItemStyle>
<ItemTemplate>
<img src='<%#getImage(Container.DataItem("status"))%>'/>
</ItemTemplate>
</asp:TemplateColumn>
This is my function

Protected Function getImage(ByVal dField As Object) As String

Select Case dField

Case "Accepted"

Return "images\approve.png"

Case "Rejected"

Return "images\deny.png"

End Select

End Function

I even tried this in my HTML also but didn't work
<asp:Image id="img" Runat="Server"
ImageUrl='<%#getImage(Container.DataItem("status") )%>'/>

any ideas?

Nov 19 '05 #2
Bu the way... why are you using Backslash ( Return "images\approve.png"
)? Shouldn't it be a Slash(Return "images/approve.png")

/Lars

"Chris" <Ch***@discussions.microsoft.com> skrev i meddelandet
news:EF**********************************@microsof t.com...
Hi,
I am trying to add images to a column based on the result of another
column.
I created a template column and using a code-behind function

this is part of my html for the grid

<asp:BoundColumn DataField="status" ReadOnly="True" HeaderText="Status">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Map!">
<HeaderStyle horizontalalign="Center"
verticalalign="Middle"></HeaderStyle>
<ItemStyle horizontalalign="Center"></ItemStyle>
<ItemTemplate>
<img src='<%#getImage(Container.DataItem("status"))%>'/>
</ItemTemplate>
</asp:TemplateColumn>
This is my function

Protected Function getImage(ByVal dField As Object) As String

Select Case dField

Case "Accepted"

Return "images\approve.png"

Case "Rejected"

Return "images\deny.png"

End Select

End Function

I even tried this in my HTML also but didn't work
<asp:Image id="img" Runat="Server"
ImageUrl='<%#getImage(Container.DataItem("status") )%>'/>

any ideas?

Nov 19 '05 #3
Hi,
I am not getting any error. Its not loading any image.

"Lars Netzel" wrote:
Bu the way... why are you using Backslash ( Return "images\approve.png"
)? Shouldn't it be a Slash(Return "images/approve.png")

/Lars

"Chris" <Ch***@discussions.microsoft.com> skrev i meddelandet
news:EF**********************************@microsof t.com...
Hi,
I am trying to add images to a column based on the result of another
column.
I created a template column and using a code-behind function

this is part of my html for the grid

<asp:BoundColumn DataField="status" ReadOnly="True" HeaderText="Status">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Map!">
<HeaderStyle horizontalalign="Center"
verticalalign="Middle"></HeaderStyle>
<ItemStyle horizontalalign="Center"></ItemStyle>
<ItemTemplate>
<img src='<%#getImage(Container.DataItem("status"))%>'/>
</ItemTemplate>
</asp:TemplateColumn>
This is my function

Protected Function getImage(ByVal dField As Object) As String

Select Case dField

Case "Accepted"

Return "images\approve.png"

Case "Rejected"

Return "images\deny.png"

End Select

End Function

I even tried this in my HTML also but didn't work
<asp:Image id="img" Runat="Server"
ImageUrl='<%#getImage(Container.DataItem("status") )%>'/>

any ideas?


Nov 19 '05 #4
Did you try View | Source in the browser to see what's actually getting sent
to the client? That's often the quickest way to see what's wrong...

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:EF**********************************@microsof t.com...
Hi,
I am trying to add images to a column based on the result of another column. I created a template column and using a code-behind function

this is part of my html for the grid

<asp:BoundColumn DataField="status" ReadOnly="True" HeaderText="Status">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
</asp:BoundColumn>
<asp:TemplateColumn HeaderText="Map!">
<HeaderStyle horizontalalign="Center"
verticalalign="Middle"></HeaderStyle>
<ItemStyle horizontalalign="Center"></ItemStyle>
<ItemTemplate>
<img src='<%#getImage(Container.DataItem("status"))%>'/>
</ItemTemplate>
</asp:TemplateColumn>
This is my function

Protected Function getImage(ByVal dField As Object) As String

Select Case dField

Case "Accepted"

Return "images\approve.png"

Case "Rejected"

Return "images\deny.png"

End Select

End Function

I even tried this in my HTML also but didn't work
<asp:Image id="img" Runat="Server"
ImageUrl='<%#getImage(Container.DataItem("status") )%>'/>

any ideas?

Nov 19 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Edward King | last post by:
Hi! I am trying to achieve the following: I have a number of help pages (in the format help_nn.php where nn=helpid). I want to be able to open a particular help page by calling the function...
11
by: Helmut Jarausch | last post by:
Hi, entering help('rstrip') or help('ljust') into IDLE's shell window I only get no Python documentation found ...
0
by: Tim21 | last post by:
OK, im miserable :)) so.. help'd b highly appreciated. Situation: Win XP aplication server RUNTIME (stored fmx files along with the ..hlp files) Fmx's generated and compiled on development...
6
by: wukexin | last post by:
Help me, good men. I find mang books that introduce bit "mang header files",they talk too bit,in fact it is my too fool, I don't learn it, I have do a test program, but I have no correct doing...
6
by: d.warnermurray | last post by:
I am doing a project for school that involves creating help files for a html authoring tool. If you could help me with answers to some questions it would really help. 1. What tasks do you expect...
3
by: Colin J. Williams | last post by:
Python advertises some basic service: C:\Python24>python Python 2.4.1 (#65, Mar 30 2005, 09:13:57) on win32 Type "help", "copyright", "credits" or "license" for more information. >>> With...
2
by: John Baker | last post by:
I find it highly annoying that MS Access tries to go online when I want to look at the help files. Is there a way to configure it so it just looks at my local helpfiles when I hit F1?
5
by: dixie | last post by:
I was wondering if there is a way of doing a simple help system with either viewing a page in a browser or looking at a definite page in a .pdf file when a help button was pushed on an Access...
5
by: Steve Teeples | last post by:
Can someone point me to a document that clearly identifies the steps of creating a good help system for an application? I have a test tool that I'd like to add help to so that others will know how...
8
by: Mark | last post by:
I have loaded Visual Studio .net on my home computer and my laptop, but my home computer has an abbreviated help screen not 2% of the help on my laptop. All the settings look the same on both...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.