如何添加"&安培;源"到DataNavigateUrlFormatString? [英] How do I add "&Source" to DataNavigateUrlFormatString?

查看:177
本文介绍了如何添加"&安培;源"到DataNavigateUrlFormatString?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

解决方法:

<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="~\SubSite\Default.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="~\SubSite\Default.aspx?Query={0}&Source=<% Request.Url.AbsolutePath%>"

我得到的网址是这样的: <$c$c>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="~\SubSite\Default.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
    }
}

这篇关于如何添加&QUOT;&安培;源&QUOT;到DataNavigateUrlFormatString?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆