Can you make NavigateUrl direct to a page with a dynamic parameter appended to the URL?
I am trying to append something from an object onto a URL so that I can make a pa开发者_C百科rameter out of it. The goal is to do something like this:
articleview.aspx?Name=AwesomeSauce
Where I could use the Name parameter on the page I'm directing toward.
I have some code here:
<asp:hyperlink Text=<%# DataBinder.Eval(Container.DataItem, "Title") %> NavigateUrl="ArticleView.aspx" </asp:hyperlink>
But I'm not sure how I could add the "?Name={variable}" part on the end. Can anyone help me out? I'm sure it's something simple that I'm missing.
Try something like this:
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# String.Format("ArticleView.aspx?Name={0}", Eval("SomeName"))%>' ... />
精彩评论