Solved

ASP.NET (The server tag is not well formed).

Posted on 2010-11-19
6
1,074 Views
Last Modified: 2012-08-14
HELP!

Populating Grid...
Trying to work with quotes (ASP.NET - VB.NET) and getting
Parser Error Message: The server tag is not well formed.

Here is what I do:
 <asp:TemplateField  HeaderText="Action" >
<HeaderStyle CssClass="gvTitle2" />
 <ItemTemplate>
<table width="100%" cellpadding="4" cellspacing="0">
 <tr>
<td><asp:HyperLink ID="linkDelete" Text="Delete" 
NavigateUrl='<%# "javascript:if(confirm('Are you sure you want to Delete the file?')) { document.location='Default.aspx?f=" & 
DataBinder.Eval(Container.DataItem,"Specs") & "&type=d';}"%>' 
runat="server" /></td>..

Open in new window


Here is what I need:

NavigateUrl="javascript:if(confirm('Are you sure you wnat to Delete the file?')) { document.location='Default.aspx?f=whatever&type=d';} "
0
Comment
Question by:smano
  • 4
  • 2
6 Comments
 
LVL 4

Expert Comment

by:Andre412
ID: 34176326
give us the full asp code in front markup for the grid
0
 
LVL 1

Author Comment

by:smano
ID: 34176429
See
<asp:GridView ID="gvFiles" Width="778px" runat="server"  CellPadding="5" 

			BorderStyle="Solid" BorderWidth="1px" BorderColor="LightGray" 

		AutoGenerateColumns="False" 

        AlternatingRowStyle-CssClass="alternateRow" AllowPaging="True" 

		PagerSettings-Mode="Numeric" PageSize="12" PagerSettings-Position="Top" EmptyDataRowStyle-CssClass="error" EmptyDataText="No record found">

		 <Columns>

		   <asp:BoundField DataField="FileName" HeaderText="File Name">

		   <ControlStyle Width="250px"></ControlStyle>

				<HeaderStyle CssClass="gvTitle" />

		        <ItemStyle CssClass="txt8" Width="300px" />

		        </asp:BoundField>

		       <asp:TemplateField  HeaderText="Action" >

		       <HeaderStyle CssClass="gvTitle2" />

		        <ItemTemplate>

		        <table width="100%" cellpadding="4" cellspacing="0">

		        <tr>													

					<td><asp:HyperLink ID="linkView" Text="View" 

					NavigateUrl='<%# "Content.aspx?f=" & DataBinder.Eval(Container.DataItem,"NavigateURL") & "&type=v"%>' 

					runat="server" /></td>

					<td><asp:HyperLink ID="linkPrint" Text="Print" NavigateUrl='<%# "Default.aspx?f=" & DataBinder.Eval(Container.DataItem,"NavigateURL") & "&type=p"%>' runat="server" /></td>

					<td><asp:HyperLink ID="linkDelete" Text="Delete" 

					NavigateUrl='<%# "javascript:if(confirm('Are you sure you want to Delete the file?')) {document.location='Default.aspx?f=" & DataBinder.Eval(Container.DataItem,"NavigateUrl") & "&type=d';}" %>'

			  		 runat="server" /></td>

					<td><asp:HyperLink ID="linkAltPrint" Text="Alternate Print" 

					NavigateUrl='<%# "Content.aspx?f=" & DataBinder.Eval(Container.DataItem,"NavigateURL") & "&type=ap"%>' 

					runat="server" /></td>

					<td><asp:HyperLink ID="linkDownload" Text="Download" 

					NavigateUrl='<%# "Download.aspx?f=" & DataBinder.Eval(Container.DataItem,"NavigateURL") & "&type=dd"%>' 

					runat="server" /></td>

				</tr>								

		        </table>

		      </ItemTemplate>

              </asp:TemplateField>   

             </Columns>

              <AlternatingRowStyle CssClass="alternateRow">

              </AlternatingRowStyle>

	  </asp:GridView>

Open in new window

0
 
LVL 1

Author Comment

by:smano
ID: 34176435
Posted complete Gridview Code
0
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
LVL 1

Author Comment

by:smano
ID: 34176450
Only NavigateURL with javascript: confirm doesn't work others are fine...
0
 
LVL 4

Accepted Solution

by:
Andre412 earned 500 total points
ID: 34176558
try this

place in code behind
    Public ReadOnly Property GetLink(ByVal insert As String) As String
        Get
            Return "javascript:if(confirm('Are you sure you want to Delete the file?')) {document.location='Default.aspx?f=" & insert & "&type=d';}"
        End Get
    End Property

Open in new window

replace link in code infront
<asp:HyperLink runat="server" ID="linkDelete" Text="Delete" 
                    NavigateUrl='<%# GetLink(DataBinder.Eval(Container.DataItem, "NavigateUrl")).Tostring %>' 
                     ></asp:HyperLink>

Open in new window

0
 
LVL 1

Author Comment

by:smano
ID: 34176645
I'll take it... Thanks!
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Drop down button NAMES disappear 1 61
Does it make sense migrate a website to MIcrosoft Azure 4 47
Hovering effect 9 46
compact pure CSS Read More Toggle 4 19
A publishing tool, a Version Control System, or a Collaboration Platform! These can be some of the defining words for the two very famous web-hosting Git repositories: Bitbucket and Github. Git is widely used amongst the programmers and developers f…
"In order to have an organized way for empathy mapping, we rely on a psychological model and trying to model it in a simple way, so we will split the board to three section for each persona and a scenario and try to see what those personas would Do,…
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

932 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now