473,322 Members | 1,259 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,322 software developers and data experts.

HelperFunction\Image

gh
I am using VS 2008. There datalist hase a filed, STATUS, that is 0, 1,
or 2. Depending on the value I want to set the Image source. I also
have a field with a description that I would like to concantenate to the
image, as the hyperlink or use a hyperlink filed for everything Below
is what I have for a function in the code behind:

protected string SetStatus(string aStatus)
{
if (aStatus == "0")
{
return "<img src = \"../images/image1.gif\" />";
}
else
if (aStatus == "0")
{
return "<img src = \"../images/image2.gif\" />";
}

}

In the aspx file below is the template markup.

<asp:DataList ID="DataList1" runat="server" RepeatColumns="3"
RepeatDirection="Horizontal" DataSourceID="SqlDataSource1"
onitemdatabound="DataList1_ItemDataBound">
<ItemTemplate>
<br />
STATUS:
<asp:Label ID="STATUSLabel" runat="server" Text='
<%# SetStstus(Convert.ToString(DataBinder.Eval(Contain er.DataItem,
"STATUS")))%>' />
<br />
<br />
</ItemTemplate>
</asp:DataList>
1. Can I add the markup to use an image and hyperlink for the cell?
2. When I try to view the page now I get the following error:

Compiler Error Message: CS0161: '_Default.SetStatus(string)': not
all code paths return a value
Line 98: }
Line 99:
Line 100: protected string SetStatus(string aStatus)
Line 101: {
Line 102: /* if (aStatus == "0")

The Status is stored as and integer but I am using a Convert.ToString in
the SetStatus call.

Waht would be the cause of the error?

TIA
Jun 27 '08 #1
0 685

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

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.