如何添加"&安培;源"到DataNavigateUrlFormatString?安培、QUOT、DataNavigateUrlFormatString

由网友(热血与梦想)分享简介:解决方法:' NavigateUrl='<%# string.F...

解决方法:

<asp:TemplateField SortExpression="Exp" HeaderText="text">
    <ItemTemplate>
        <asp:HyperLink runat="server" Text='<%# Eval("Name") %>' NavigateUrl='<%# string.Format("~/SubSite/Default.aspx?reg={0}&Source={1}", Eval("Id"), Request.Url) %>' />
    </ItemTemplate>
</asp:TemplateField>

相反的:

<asp:HyperLinkField DataTextField="Name" DataNavigateUrlFields="Id"
                DataNavigateUrlFormatString="~SubSiteDefault.aspx?reg={0}"
                HeaderText="text" SortExpression="Exp" />

问候

Greetings

我有一个包含一些HyperLinkFields一个GridView。我所试图做的是添加了&放大器;源代码。在查询中的 DataNavigateUrlFormatString 当我点击了一个超链接

I have a GridView containing some HyperLinkFields. What I am trying to do is to add the "&Source" query in the DataNavigateUrlFormatString when I click one of the hyperlinks.

当我这样做是这样的: DataNavigateUrlFormatString =?〜子网站 Default.aspx的查询= {0}&放大器;源=&LT;%Request.Url.AbsolutePath%&GT;

When I do it like this: DataNavigateUrlFormatString="~SubSiteDefault.aspx?Query={0}&Source=<% Request.Url.AbsolutePath%>"

我得到的网址是这样的: http://www.website.com/SubSite/Default.aspx?Query=702&Source=<%Request.Url.AbsolutePath%>

The URL I get is this: http://www.website.com/SubSite/Default.aspx?Query=702&Source=<%Request.Url.AbsolutePath%>

我如何确保写道:我试着打通网址&LT;%Request.Url.AbsolutePath%&GT;

How do I make sure it writes the URL that I try to get through <% Request.Url.AbsolutePath%>?

推荐答案

试试这个:

DataNavigateUrlFormatString="~SubSiteDefault.aspx?Query={0}&Source=" +Request.Url.AbsolutePath

或者这样:

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
    if (e.Row.RowType == DataControlRowType.DataRow)
    {
        // Find the control and set the values you need
    }
}
阅读全文

相关推荐

最新文章