Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Subroutine /helper function error

Reply
Thread Tools

Subroutine /helper function error

 
 
Chumley the Walrus
Guest
Posts: n/a
 
      06-10-2004
I'm using a subroutine/helper function display an image (the image
would be displayed inside a datalist control's <itemtemplate> )

<script language="VB" runat="server">
Public Sub checkforimg(ByVal Imagesubprod1 As String)
If Imagesubprod1 <> "" then
response.write(Imagesubprod1)
Else
response.write("nbsp;")
End If
End Sub
</script>

.... but I get an "Overload resolution failed because no accessible
'ToString' can be called with these arguments:" error when it comes
time to check for the image as follows.

<%# checkforimg(DataBinder.Eval(Container.DataItem,
"Imagesubprod1"))%>

When I form the header for the sub as follows:
Public Sub checkforimg(ByVal Imagesubprod1 As String) As string

...i get an "Expected end of statement " error on this line
 
Reply With Quote
 
 
 
 
Craig Deelsnyder
Guest
Posts: n/a
 
      06-10-2004
On 10 Jun 2004 11:55:42 -0700, Chumley the Walrus <(E-Mail Removed)>
wrote:

> I'm using a subroutine/helper function display an image (the image
> would be displayed inside a datalist control's <itemtemplate> )
>
> <script language="VB" runat="server">
> Public Sub checkforimg(ByVal Imagesubprod1 As String)
> If Imagesubprod1 <> "" then
> response.write(Imagesubprod1)
> Else
> response.write("nbsp;")
> End If
> End Sub
> </script>
>
> ... but I get an "Overload resolution failed because no accessible
> 'ToString' can be called with these arguments:" error when it comes
> time to check for the image as follows.
>
> <%# checkforimg(DataBinder.Eval(Container.DataItem,
> "Imagesubprod1"))%>


looks like it's having trouble converting the value you're passing in thru
databinding to a String. If you have Option Strict on, you might try
either casting the value in the databinding statement to a string before
passing it in, or change the parameter in your method above to an Object
and then cast it inside the function itself.

Otherwise verify the value in your datasource is truly capable of being a
string.

--
Craig Deelsnyder
Microsoft MVP - ASP/ASP.NET
 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      06-10-2004
IE does not support inline images, so you code should be writing something
like: <img src=url> not the binary image.

-- bruce (sqlwork.com)


"Chumley the Walrus" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) m...
> I'm using a subroutine/helper function display an image (the image
> would be displayed inside a datalist control's <itemtemplate> )
>
> <script language="VB" runat="server">
> Public Sub checkforimg(ByVal Imagesubprod1 As String)
> If Imagesubprod1 <> "" then
> response.write(Imagesubprod1)
> Else
> response.write("nbsp;")
> End If
> End Sub
> </script>
>
> ... but I get an "Overload resolution failed because no accessible
> 'ToString' can be called with these arguments:" error when it comes
> time to check for the image as follows.
>
> <%# checkforimg(DataBinder.Eval(Container.DataItem,
> "Imagesubprod1"))%>
>
> When I form the header for the sub as follows:
> Public Sub checkforimg(ByVal Imagesubprod1 As String) As string
>
> ..i get an "Expected end of statement " error on this line



 
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
use one subroutine's variable value in another subroutine inside a module. king Perl Misc 5 04-29-2007 06:39 AM
Subroutine Function nicolas-laurent Perl Misc 3 03-04-2005 01:20 PM
How can I call a subroutine / function and not wait for it to return? bayxarea-usenet@yahoo.com Perl Misc 9 01-27-2005 04:24 PM
Can't get subroutine/helper function to work in Datalist control Chumley the Walrus ASP .Net 2 06-15-2004 11:30 AM
Can't get subroutine/helper function to work in Datalist control Chumley the Walrus ASP .Net Web Controls 1 06-14-2004 08:32 PM



Advertisments