1

i tried to construct url in asp.net like this

<asp:HyperLink ID="edit" runat="server" NavigateUrl="./edit.aspx/&action=edit&id=<%#Eval("id")%>">Edit</asp:HyperLink>

but i get an error when i run the asp.net page

Parser Error Message: The server tag is not well formed.

Source Error:

Line 71: ">Edit

Source File: /admin/vehicle/view.aspx Line: 71

can anyone help me out

2 Answers 2

2
<asp:HyperLink ID="edit" runat="server" NavigateUrl='<%# "./Edit.aspx/action=edit&id=" & Server.UrlEncode(Container.DataItem("MyID"))%>'/>
Sign up to request clarification or add additional context in comments.

Comments

2

I prefer the "~/" so that it will resolve as root sites and virtual directories:

<asp:HyperLink ID="edit" runat="server" 
   NavigateUrl='<%# String.Format("~/edit.aspx/&action=edit&id={0}",Eval("id"))%>'>Edit</asp:HyperLink>

1 Comment

"~/" points to site root directory, instead of current directory

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.