Showing posts with label inside. Show all posts
Showing posts with label inside. Show all posts

Saturday, March 31, 2012

Subroutine /helper function error

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 lineOn 10 Jun 2004 11:55:42 -0700, Chumley the Walrus <springb2k@.yahoo.com>
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
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" <springb2k@.yahoo.com> wrote in message
news:1ef65641.0406101055.8852102@.posting.google.com...
> 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

Saturday, March 24, 2012

super simple asp question

I'm tryinh to write a restricted character into a variable and i'm not sure what the replacement is.

Basically I want to put a " inside a variable string.

like:

Body = "And he said: "blah blah blah." "

Any idea how to do that and not have the string break?

i'm going to be writing xml with asp and pulling data from a form and I know xml is really sensitive and an apostraphe over quotations won't cut it.

Thanks.

well i know for c# it is string mystring = "hello world\\". you have to use double the \

EDIT: not sure why i used \ in the example, but for a quote you do it the same way string mystring = "hello \"world\"'; giving you hello "world"


In VB.NET you simply double your quotes like so:

Dim strTest As String = "President Bush said ""No Comment"" in response to my question."


ok i'll try these, thanks for your help :)

Tuesday, March 13, 2012

Switch between TextBox and Label inside DataGrid

I have DataGrid with Label in one of its columns. Label should change into
TextBox, when user do some specific action. How can I acomplish this??

P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
because my OE news reader doesn't show all my posts.I'm trying this:

<asp:TemplateColumn HeaderText="Sum">
<ItemTemplate>
<asp:Label id="lblSum" runat="server" Text='<%#
Container.DataItem("Sum") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtSum" runat="server" Text='<%#
Container.DataItem("Sum") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn
but when I do this:

DataGrid1.EditItemIndex = index

all DataGrid fields in selected row becomes editable and I wan't only one
specific field to be editable (TextBox). What should I do? :(
You need to make an ItemTemplate including both the label and the textbox
and control their visibility depending
on user actions. For an experienced javascript programmer I would recommend
doing it on client side. Otherwise you can do it on server side, possibly
with AJAX or other similar technologies.

Eliyahu

"John Smith" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> I have DataGrid with Label in one of its columns. Label should change into
> TextBox, when user do some specific action. How can I acomplish this??
>
> P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
> because my OE news reader doesn't show all my posts.
Hi,

I think you want to edit values by switching between label and textbox. The
following link would be very helpful.

http://www.syncfusion.com/FAQ/aspnet/WEB_c4c.aspx#q391q

Thanks
Sharmila

"John Smith" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> I have DataGrid with Label in one of its columns. Label should change into
> TextBox, when user do some specific action. How can I acomplish this??
>
> P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
> because my OE news reader doesn't show all my posts.
Thanks.

Switch between TextBox and Label inside DataGrid

I have DataGrid with Label in one of its columns. Label should change into
TextBox, when user do some specific action. How can I acomplish this'
P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
because my OE news reader doesn't show all my posts.I'm trying this:
<asp:TemplateColumn HeaderText="Sum">
<ItemTemplate>
<asp:Label id="lblSum" runat="server" Text='<%#
Container.DataItem("Sum") %>'>
</asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox id="txtSum" runat="server" Text='<%#
Container.DataItem("Sum") %>'>
</asp:TextBox>
</EditItemTemplate>
</asp:TemplateColumn>
but when I do this:
DataGrid1.EditItemIndex = index
all DataGrid fields in selected row becomes editable and I wan't only one
specific field to be editable (TextBox). What should I do? :(
You need to make an ItemTemplate including both the label and the textbox
and control their visibility depending
on user actions. For an experienced javascript programmer I would recommend
doing it on client side. Otherwise you can do it on server side, possibly
with AJAX or other similar technologies.
Eliyahu
"John Smith" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> I have DataGrid with Label in one of its columns. Label should change into
> TextBox, when user do some specific action. How can I acomplish this'
>
> P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
> because my OE news reader doesn't show all my posts.
>
Hi,
I think you want to edit values by switching between label and textbox. The
following link would be very helpful.
http://www.syncfusion.com/FAQ/aspnet/WEB_c4c.aspx#q391q
Thanks
Sharmila
"John Smith" <john.smith@.microsoft.com> wrote in message
news:gcchg.3497$oj5.1152372@.news.siol.net...
> I have DataGrid with Label in one of its columns. Label should change into
> TextBox, when user do some specific action. How can I acomplish this'
>
> P.S. Sorry for multiple posts in the same newsgroup, but I had to do that,
> because my OE news reader doesn't show all my posts.
>
Thanks.