帮助传递查询字符串? [英] Help with passing query string?

查看:98
本文介绍了帮助传递查询字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在点击任意生成的超链接时传递查询字符串值。这样的东西..



I am trying to pass query string value on clicking any hyperlink which are dnamically generated. Something like this..

<%
------some code----
 clickedalbum = dt6.Rows[0]["albumid"].ToString();

  %>
      <asp:HyperLink ID="HyperLink1" runat="server" href="attendance1.aspx?albumid=<%#clickedalbum %>" >







结果以上代码我得到的是:

abc.aspx?albumid =%3C%#clickedalbum%20 %% 3E



所需结果:

abc.aspx?albumid = 25




The result of above code which i am getting is :
abc.aspx?albumid=%3C%#clickedalbum%20%%3E

desired Result:
abc.aspx?albumid=25

推荐答案

我认为由于服务器控制问题。如果不是真的需要服务器控制,请尝试使用html控件。



I think issue because of server control. If server control is not really required try using html control.

<a href=''attendance1.htm?albumid=<%=clickedalblum%>''>Test</a>







谢谢




Thanks


亲爱的,亲爱的arbaaz jalil。



Visual Studio为我们提供了便利,我们也可以在HTML代码中定义c#代码。

如果要将任何变量或运行时数据绑定到继承类的任何控件,则可以使用<%#%>标签。



这里是一些示例代码,我试图将QueryString值绑定到超链接。



见下面的代码。



Ya sure dear arbaaz jalil.

Visual Studio facilitates us that we can also define c# code within our HTML code.
If you want to bind any variable or runtime data to any control from your inherited class then you can do it using <%# %> tag.

here is some sample code where i am trying to binding QueryString value to a Hyperlink.

See below code.

<asp:hyperlink id="HyperLink1" navigateurl="<%= Request.QueryString["id"] %>" runat="server" xmlns:asp="#unknown"><![CDATA[<%= Request.QueryString["id"] %>]]></asp:hyperlink>

   <asp:label id="Label1" runat="server" xmlns:asp="#unknown"><![CDATA[<%= Request.QueryString["id"] %>]]></asp:label>

        <asp:label id="Label2" runat="server" xmlns:asp="#unknown"><![CDATA[<%= Request.QueryString["id"] %>]]></asp:label>

    <%= Request.QueryString["id"] %>


亲爱的arbaaz jalil。



Visual Studio为我们提供了便利也可以在我们的HTML代码中定义c#代码。

如果要将任何变量或运行时数据绑定到继承类的任何控件,那么可以使用<%#%>标签。



这里是一些示例代码,我试图将QueryString值绑定到超链接。



见下面的代码。



< pre lang =" HTML"> < asp:HyperLink ID =" HyperLink1" NavigateUrl = '' <%=的Request.QueryString [" ID"]%GT; '' RUNAT = QUOT;服务器"><%=的Request.QueryString [" ID"]%GT;< / ASP :HyperLink>



< asp:Label ID =" Label1" RUNAT = QUOT;服务器"><%=的Request.QueryString [" ID"]%GT;< / ASP:标签>



将ASP :标签ID =" Label2" RUNAT = QUOT;服务器"><%=的Request.QueryString [" ID"]%GT;< / ASP:标签>



将% = Request.QueryString [" id"]%>< / pre>
Ya sure dear arbaaz jalil.

Visual Studio facilitates us that we can also define c# code within our HTML code.
If you want to bind any variable or runtime data to any control from your inherited class then you can do it using <%# %> tag.

here is some sample code where i am trying to binding QueryString value to a Hyperlink.

See below code.

<pre lang="HTML"> <asp:HyperLink ID="HyperLink1" NavigateUrl=''<%= Request.QueryString["id"] %>'' runat="server"><%= Request.QueryString["id"] %></asp:HyperLink>

<asp:Label ID="Label1" runat="server"><%= Request.QueryString["id"] %></asp:Label>

<asp:Label ID="Label2" runat="server"><%= Request.QueryString["id"] %></asp:Label>

<%= Request.QueryString["id"] %></pre>


这篇关于帮助传递查询字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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