获得一个URL参数到asp.net标签 [英] Getting a url parameter into asp.net label

查看:81
本文介绍了获得一个URL参数到asp.net标签的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想自动设置一个ASP的文本:标签的URL参数,但它似乎并没有工作。

I am trying to automatically set the text of a asp:label to a url parameter but it does not seem to work.

这是code我有:

     <asp:Label ID="lblHouse" runat="server" 
        Text='<%# Request.QueryString["Selection"] %>' 
        Font-Bold="True" 
        Font-Size="Large"></asp:Label> <br /> <br />

我是什么做错了吗?

What am I doing wrong?

感谢您的帮助。

推荐答案

您可以使用&lt;%=%>(而不是&LT;%#),并把它的ASP内部:标签标记,而不是Text属性

You can use <%= %> (instead of <%#) and put it inside of the asp:label tag, instead of the Text property:

            <asp:Label ID="lblHouse" runat="server"  
            Font-Bold="True"  
            Font-Size="Large"><%= Server.HTMLEncode(Request.QueryString["Selection"]) %></asp:Label>

这篇关于获得一个URL参数到asp.net标签的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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