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

Could not open Design view. Quote values differently in a '<%..."values"...%>' block.

Hi all,

I am getting the above error when I try to flick from HTML to Design view in
Visual Studio - I get the jist of the error message, and I know the line of
code which it refers to which is this;

<asp:TemplateColumn>

<ItemTemplate>

<a class="normalText" href="javascript:void(0);"
onclick="populateForm('<%=Request.QueryString("con trolid") %>', '<%#
DataBinder.Eval(Container.DataItem, "CrfExpansion") %> ','<%=("hid" &
Right(Request.QueryString("controlid"),
Len(Request.QueryString("controlid"))-3)) & "Code"%>', '<%#
DataBinder.Eval(Container.DataItem, "CrfDHANationalCode") %>');">Select</a>

</ItemTemplate>

</asp:TemplateColumn>
As you can see theres a good mixture of crap in there! It's the onClick
event that I believe is the problem - which reads:

onclick="populateForm
(
'<%=Request.QueryString("controlid") %>',
'<%# DataBinder.Eval(Container.DataItem, "CrfExpansion") %> ',
'<%=("hid" & Right(Request.QueryString("controlid"),
Len(Request.QueryString("controlid"))-3)) & "Code"%>',
'<%# DataBinder.Eval(Container.DataItem, "CrfDHANationalCode") %>'
)

if we break it open...Can anyone suggest how this might be changed to allow
me to flick back and forth again, I had assumed that I would need the single
quotes ( ' ) around the values that I'm sending the javascript function,
incase for example there was a comma ( , ) in the values coming through (for
whatever reason), and I'm used to having double quotes ( " ) in syntax such
as Request.QueryString("blah")

Whats most annoying is that until I flick back to Design view it wont add
any of the server controls I've typed in manually (well copied and pasted
and renamed) to the code behind view - and I dont fancy typing that little
lot in! :o)

Any suggestions appreciated.

Regards

Rob
Nov 18 '05 #1
2 1566
I would consider building the entire anchor by writing out a literal and
binding it to the form. For example, you can stick a panel on the page and
bind the literals there (LiteralControl). Your biggest issue here is double
quotes within single quotes within double quotes. The whole thing can be
built behind the scenes. To break it out, you end up with something like:

//C# version
StringBuilder sb = new StringBuilder();
sb.Append("<a class=\"normalText\" href=\"javascript:void(0);\" ");
sb.Append("onclick=\"populateForm('"+Request.Query String("controlid")+"',
");
//etc.

LiteralControl lc = new LiteralControl(sb.ToString());
Panel1.Controls.Add(lc);

--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

************************************************
Think Outside the Box!
************************************************
"Rob Meade" <ro**********@NOSPAMubht.swest.nhs.uk> wrote in message
news:Om**************@TK2MSFTNGP10.phx.gbl...
Hi all,

I am getting the above error when I try to flick from HTML to Design view in Visual Studio - I get the jist of the error message, and I know the line of code which it refers to which is this;

<asp:TemplateColumn>

<ItemTemplate>

<a class="normalText" href="javascript:void(0);"
onclick="populateForm('<%=Request.QueryString("con trolid") %>', '<%#
DataBinder.Eval(Container.DataItem, "CrfExpansion") %> ','<%=("hid" &
Right(Request.QueryString("controlid"),
Len(Request.QueryString("controlid"))-3)) & "Code"%>', '<%#
DataBinder.Eval(Container.DataItem, "CrfDHANationalCode") %>');">Select</a>
</ItemTemplate>

</asp:TemplateColumn>
As you can see theres a good mixture of crap in there! It's the onClick
event that I believe is the problem - which reads:

onclick="populateForm
(
'<%=Request.QueryString("controlid") %>',
'<%# DataBinder.Eval(Container.DataItem, "CrfExpansion") %> ',
'<%=("hid" & Right(Request.QueryString("controlid"),
Len(Request.QueryString("controlid"))-3)) & "Code"%>',
'<%# DataBinder.Eval(Container.DataItem, "CrfDHANationalCode") %>'
)

if we break it open...Can anyone suggest how this might be changed to allow me to flick back and forth again, I had assumed that I would need the single quotes ( ' ) around the values that I'm sending the javascript function,
incase for example there was a comma ( , ) in the values coming through (for whatever reason), and I'm used to having double quotes ( " ) in syntax such as Request.QueryString("blah")

Whats most annoying is that until I flick back to Design view it wont add
any of the server controls I've typed in manually (well copied and pasted
and renamed) to the code behind view - and I dont fancy typing that little
lot in! :o)

Any suggestions appreciated.

Regards

Rob

Nov 18 '05 #2
"Cowboy (Gregory A. Beamer) [MVP]" wrote ...
I would consider building the entire anchor by writing out a literal and
binding it to the form. For example, you can stick a panel on the page and
bind the literals there (LiteralControl). Your biggest issue here is double quotes within single quotes within double quotes. The whole thing can be
built behind the scenes. To break it out, you end up with something like:

//C# version
StringBuilder sb = new StringBuilder();
sb.Append("<a class=\"normalText\" href=\"javascript:void(0);\" ");
sb.Append("onclick=\"populateForm('"+Request.Query String("controlid")+"',
");
//etc.

LiteralControl lc = new LiteralControl(sb.ToString());
Panel1.Controls.Add(lc);


Hi Gregory,

Many thanks for your informative reply - I now have it working -yay! :)

Regards

Rob
Nov 18 '05 #3

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

Similar topics

0
by: web1110 | last post by:
Hi y'all, I was playing with the NorthWind database, displaying subtables in a DataGrid. It worked fine for 3 levels, but when I added a fourth, I got the following error: These columns...
3
by: Kevin Pedersen | last post by:
Hello, I am using an editable datagrid. After I save the changes the datagrid shows the old values. I've read the posts about the Page_Load and not binding the datagrid each time. The SQL that...
1
by: csgraham74 | last post by:
Hi guys, Im having a real problem with the formatting of my code below. I continue getting the "quote values differently inside a '<%..."value"...%>' block. Can anyone please help me sort out...
6
by: Rich | last post by:
Hello, I have to create a table in an Access mdb (remotely) on the fly. Create Table tbl1(fld1 Integer, fld2 varchar(10), fld3...) Then I have to insert data: Insert Into tbl1 Values(" &...
2
by: j-in-uk | last post by:
Hi, I seem to get the error on DataRelation r2, the values are unique so I don't know why I am getting the error. Any sugesstions? DataRelation r1 = ds.Relations.Add(dtContinent_ContinentID,...
5
by: dfetrow410 | last post by:
I know the typical fix for this problem, but I am not sure how to fix this line: <a...
2
by: stef mientki | last post by:
hello, The next piece of code bothers me: ptx, pty, rectWidth, rectHeight = self._point2ClientCoord (p1, p2 ) dc.SetClippingRegion ( ptx, pty, rectWidth, rectHeight ) Because I want to...
1
by: StuartD | last post by:
I have a sub form that is populated based on the selection of a year from a combo box on the main form. I'm trying to add a second main form combo box for item category to further filter the sub...
3
by: dorandoran | last post by:
function openMyWindow() { var myID = document.getElementById('ctl00_maincontent_txtEmpID').value; //var fname = document.getElementById('<%= lblFullName.ClientID %>').value; //var...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.