By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,293 Members | 1,621 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,293 IT Pros & Developers. It's quick & easy.

HTML quotes problem

P: n/a
I have an issue i can work around, but i'm trying to figure out what i'm
"supposed" to do.

i have a line of HTML/ASP.NET code inside a repeater that is something like
this

<a href="page.aspx?s=<%# DataBinder.Eval(Container, "DataItem.TheData")
%>">Text</a>

This code executes perfectly, and does exactly what i want. When i try to
switch from HTML view to Design view, VS.NET2003 yells at me saying i need
to quote something differently. So, i figured i'd change the quotes...
well.. i can't change the "DataItem.TheData" to 'DataItem.TheData' because
thats a C# character literal, but with too many characters, and it doesn't
like that. I can change the "page.aspx?s= ... "> to be 'page.aspx?s=...'>
but that breaks some of my links that actually have the ' character in their
address.
So what do i do?
Whats the "proper" way to do this so i can actually switch back and forth
between HTML view and Design view without any hassle?

Thanks in advance!

Tim
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
Attaching something i use currently.... doesnt give me the annoying quotes
message

<asp:TemplateColumn>
<ItemTemplate>
<P align="center">
<asp:HyperLink ImageUrl="../Images/edit.gif" NavigateUrl='<%#
"CA_EditSubCategory.aspx?SubCatID=" +
DataBinder.Eval(Container.DataItem,"SubCategoryID" ) %>' runat="server"
ID="Hyperlink1"/>
</P>
</ItemTemplate>
</asp:TemplateColumn>

HTH

HD

"Tim Mulholland" <Mu***************@alumni.virginia.edu> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I have an issue i can work around, but i'm trying to figure out what i'm
"supposed" to do.

i have a line of HTML/ASP.NET code inside a repeater that is something like this

<a href="page.aspx?s=<%# DataBinder.Eval(Container, "DataItem.TheData")
%>">Text</a>

This code executes perfectly, and does exactly what i want. When i try to
switch from HTML view to Design view, VS.NET2003 yells at me saying i need
to quote something differently. So, i figured i'd change the quotes...
well.. i can't change the "DataItem.TheData" to 'DataItem.TheData' because
thats a C# character literal, but with too many characters, and it doesn't
like that. I can change the "page.aspx?s= ... "> to be 'page.aspx?s=...'>
but that breaks some of my links that actually have the ' character in their address.
So what do i do?
Whats the "proper" way to do this so i can actually switch back and forth
between HTML view and Design view without any hassle?

Thanks in advance!

Tim

Nov 18 '05 #2

P: n/a
i don't have my code here in front of me, but i'm guessing that this code
will output an anchor tag with double quotes around the href instead of
single quotes? I ask because you have single quotes around the NavigateUrl
property and i just want to make sure (though, i guess i'm just being lazy
and i could test it myself when i get home - but i figured i'd ask :) )

Thanks for your help

Tim

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:ON**************@TK2MSFTNGP10.phx.gbl...
Attaching something i use currently.... doesnt give me the annoying quotes
message

<asp:TemplateColumn>
<ItemTemplate>
<P align="center">
<asp:HyperLink ImageUrl="../Images/edit.gif" NavigateUrl='<%#
"CA_EditSubCategory.aspx?SubCatID=" +
DataBinder.Eval(Container.DataItem,"SubCategoryID" ) %>' runat="server"
ID="Hyperlink1"/>
</P>
</ItemTemplate>
</asp:TemplateColumn>

HTH

HD

"Tim Mulholland" <Mu***************@alumni.virginia.edu> wrote in message
news:OS**************@tk2msftngp13.phx.gbl...
I have an issue i can work around, but i'm trying to figure out what i'm
"supposed" to do.

i have a line of HTML/ASP.NET code inside a repeater that is something

like
this

<a href="page.aspx?s=<%# DataBinder.Eval(Container, "DataItem.TheData")
%>">Text</a>

This code executes perfectly, and does exactly what i want. When i try to switch from HTML view to Design view, VS.NET2003 yells at me saying i need to quote something differently. So, i figured i'd change the quotes...
well.. i can't change the "DataItem.TheData" to 'DataItem.TheData' because thats a C# character literal, but with too many characters, and it doesn't like that. I can change the "page.aspx?s= ... "> to be 'page.aspx?s=...'> but that breaks some of my links that actually have the ' character in

their
address.
So what do i do?
Whats the "proper" way to do this so i can actually switch back and forth between HTML view and Design view without any hassle?

Thanks in advance!

Tim


Nov 18 '05 #3

P: n/a
href can be assigned a URL string with a single quote ' or a double quote ".
no issues bout that

Chao,

HD

"Tim Mulholland" <Mu***************@alumni.virginia.edu> wrote in message
news:eu**************@TK2MSFTNGP10.phx.gbl...
i don't have my code here in front of me, but i'm guessing that this code
will output an anchor tag with double quotes around the href instead of
single quotes? I ask because you have single quotes around the NavigateUrl
property and i just want to make sure (though, i guess i'm just being lazy
and i could test it myself when i get home - but i figured i'd ask :) )

Thanks for your help

Tim

"Hermit Dave" <he************@CAPS.AND.DOTS.hotmail.com> wrote in message
news:ON**************@TK2MSFTNGP10.phx.gbl...
Attaching something i use currently.... doesnt give me the annoying quotes
message

<asp:TemplateColumn>
<ItemTemplate>
<P align="center">
<asp:HyperLink ImageUrl="../Images/edit.gif" NavigateUrl='<%#
"CA_EditSubCategory.aspx?SubCatID=" +
DataBinder.Eval(Container.DataItem,"SubCategoryID" ) %>' runat="server"
ID="Hyperlink1"/>
</P>
</ItemTemplate>
</asp:TemplateColumn>

HTH

HD

"Tim Mulholland" <Mu***************@alumni.virginia.edu> wrote in message news:OS**************@tk2msftngp13.phx.gbl...
I have an issue i can work around, but i'm trying to figure out what i'm "supposed" to do.

i have a line of HTML/ASP.NET code inside a repeater that is something

like
this

<a href="page.aspx?s=<%# DataBinder.Eval(Container, "DataItem.TheData") %>">Text</a>

This code executes perfectly, and does exactly what i want. When i try

to switch from HTML view to Design view, VS.NET2003 yells at me saying i need to quote something differently. So, i figured i'd change the quotes...
well.. i can't change the "DataItem.TheData" to 'DataItem.TheData' because thats a C# character literal, but with too many characters, and it doesn't like that. I can change the "page.aspx?s= ... "> to be 'page.aspx?s=...'> but that breaks some of my links that actually have the ' character in

their
address.
So what do i do?
Whats the "proper" way to do this so i can actually switch back and forth between HTML view and Design view without any hassle?

Thanks in advance!

Tim



Nov 18 '05 #4

P: n/a
Hi Tim,

Thank you for using Microsoft Newsgroup Service. As for the question you
mentioned, I think Hermit's suggestion is quite correct. In case that you
want to use some quote ("") in the <%# %> bound, you should use '' to
include the <%# %> rather than use "", For example:
<ItemTemplate>

<asp:HyperLink NavigateUrl='<%# "target.aspx?id="
+DataBinder.Eval(Container.DataItem,"id")%>' runat="server"
ID="lnkNav">view</asp:HyperLink>

</ItemTemplate>

But be careful that don't include other text in the '' beside the <%# %>,
such as:

<asp:HyperLink NavigateUrl='other text<%# "target.aspx?id="
+DataBinder.Eval(Container.DataItem,"id")%>' runat="server"
ID="lnkNav">view</asp:HyperLink>

That'll cause all the expression between '' be analyzed as a normal string.
The <%# ........%> bound will be output as plain text.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #5

P: n/a
Hi Tim,

Have you tried my suggestion in the last reply or have you resolved your
problem? Please feel free to let me know if you have any problem on it.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 18 '05 #6

P: n/a
was finally able to test it, and yes, it works fine.
thanks to all
"MSFT" <v-******@online.microsoft.com> wrote in message
news:0I**************@cpmsftngxa07.phx.gbl...
Hi Tim,

Have you tried my suggestion in the last reply or have you resolved your
problem? Please feel free to let me know if you have any problem on it.

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Nov 18 '05 #7

P: n/a
Hi Tim,

Thanks for your response. I'm glad that you've resolved the problem.
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.