c# .net 更改标签文本 [英] c# .net change label text

查看:127
本文介绍了c# .net 更改标签文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我尝试使用此代码,但由于某种原因它不起作用.真的需要帮助.问题是当我进入网站时,标签不会从标签"更改名称.

Hello for I trying to use this code but for some reason it doesn't work. Really need help with this. The problem is that the label doesn't change name from "label" when I enter the site.

<asp:Label ID="Label1" runat="server" Text="label"></asp:Label>


<% 
    Label1.Text = "test";
    if (Request.QueryString["ID"] != null)
    {

        string test = Request.QueryString["ID"];
        Label1.Text = "Du har nu lånat filmen:" + test;
    }

     %>

推荐答案

你应该转换测试类型>>>> test.tostring();

you should convert test type >>>> test.tostring();

把最后一行改成这样:

Label1.Text = "Du har nu lånat filmen:" + test.tostring();

这篇关于c# .net 更改标签文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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