Asp.net示例问题 [英] Asp.net sample question
本文介绍了Asp.net示例问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
string resp ="abcd";
我想查看resp到我们网页的价值.
我想在我们的.aspx页面中将代码编写为html源代码.
查看此代码是什么.
请帮助我
string resp = "abcd";
i want to view the value of resp to our web page.
i want to write code to html source code in our .aspx page.
What is the code to view this.
Please help me
推荐答案
ans是
ans is
Response.Write(resp);
如果要添加搅拌值作为任何HTML元素的内容,请执行以下操作.
使用runat ="server"将HTML元素添加到aspx,例如:
If you want to add stirng value as a content of any HTML element, do following.
add HTML element to aspx with runat="server", example:
<div id="myDiv" runat="server" />
在下面的代码中添加以下行:
Add follwoing lines to code-behind:
string resp = "abcd";
myDiv.innerHtml = resp;
这是另一种方式
Here is another way
<asp:Label runat="server" ID="lblDemo" Text="<%# resp %>"></asp:Label>
并且不要忘记公开该变量
and dont forget to make the varible public
这篇关于Asp.net示例问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文