p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: ASP.NET Website Programming Problem-Design-Solution (http://p2p.wrox.com/forumdisplay.php?f=23)
-   -   DataList <a Href> Question in Roles.aspx (http://p2p.wrox.com/showthread.php?t=19278)

bekim October 1st, 2004 02:09 PM

DataList <a Href> Question in Roles.aspx
The code for Roles.aspx works fine but I can't view the code in Design view cuz I get an error: "Could Not open in Design View. Quote value differently inside a'<%..."value"...%>'block"
  How do I correct this error?

Code that works:
<asp:DataList id="RoleList" runat="server">
<a href="EditRole.aspx?RoleID=<%# DataBinder.Eval(Container.DataItem, "RoleID") %>"><%# DataBinder.Eval(Container.DataItem, "Description") %></a><br/>

Can someone correct this code so I can see it in Design View. Thanks

bekim October 1st, 2004 02:15 PM

Also when I tried <a href='EditRole.aspx?RoleID=<%# DataBinder.Eval(Container.DataItem, "RoleID") %>'>
 I can see in Design View but I get: "Error Creating Control" for the DataList. Please help

bmains October 4th, 2004 09:32 AM

Try making it a server control:

<asp:Hyperlink id="id" runat="server" NavigateUrl='EditRole.aspx?RoleID=<%# %>'>


englere October 4th, 2004 10:14 PM

This is due to a bug in Visual Studio. The fix you made to change one set of quotes to single, instead of double, is a commonly used work-around. This work-around doesn't always work in every case, as you saw here.

Most of us just settle for not seeing every web form in the designer. Since flow layout is used in this application, the Web Form designer is of limited use anyway. The authors of ThePhile did most of the .aspx pages "by hand" in the HTML view.

I was plesantly surprised how good the whole site looks with Mozilla-style browsers. This is an indicator that the authors spent a lot of time editting the HTML code. It never looks this good in Mozilla if you just plop down components in the Web form designer.


bmains October 5th, 2004 07:23 AM

When I embed this databinding notation in server controls, I haven't had any problems viewing the web forms.


englere October 5th, 2004 02:54 PM

The problem is only when you have nested double quotes. The Web Form designer isn't smart enough to understand this syntax, although it is a valid syntax.

Sometimes changing the outer set of quotes to single (the ones that get sent down to HTML) will work because VS doesn't see a double set of double quotes. This doesn't work for one of the pages in ThePhile (I don't remember which one right now).

This is a frequent question in the ASP.NET newsgroup. I haven't tried this in the beta for ASP.NET 2, but it may be fixed. I want to try this when I get some free time.


All times are GMT -4. The time now is 07:26 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.