如何在ASP.NET Web窗体中显示变量值? [英] How to show a variable value in ASP.NET Web Forms?

查看:36
本文介绍了如何在ASP.NET Web窗体中显示变量值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试显示这样的变量值:

I try to show variable value like this:

<% userTotalCount.ToString(); %>

但是我知道一开始该值为null,这就是为什么我在页面上看不到任何内容的原因. userTotalCount 的值稍后在 Page_Load()事件中设置.设置后如何显示该值.

But I understand that at the start the value is null, that's why I can't see anything on the page. Value of userTotalCount Variable sets later in Page_Load() event. How to show this value after it being set.

推荐答案

您可以使用标签控件进行设置.首先获取标签 control ,然后在 page load 事件中将文本设置为该 label .

You can set using label control . First take a label control , and then set the text to that label on page load event .

这篇关于如何在ASP.NET Web窗体中显示变量值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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