在ASP.NET中使用C Sharp的附加概念 [英] addition concept using c sharp in asp.net

查看:71
本文介绍了在ASP.NET中使用C Sharp的附加概念的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须在aspx页面中使用单个textbox和两个按钮(添加,结果)..

首先,我必须在文本框中输入一些值,然后单击添加,然后我必须在同一文本框中输入另一个数字,然后单击结果按钮后,我必须将这两个值相加并在同一文本框中显示结果? />
在这种情况下为我提供帮助

I have to use single textbox , and two buttons(add, result)... in my aspx page..

first i have to enter some values in textbox and click add and then i have to enter the another number in the same textbox and then after clicking the result button , i have add those two values and display the result in the same textbox?

help me in this scenario

推荐答案


首先单击添加按钮时,可以使用应用程序保存值:

when you click on add button for first you can use Application to save value :
Application["FirstValue"]=textbox1.text;


并单击结果按钮时:


and when click on result button :

int result=(int)Application["FirstValue"]+Convert.ToInt32(textbox1.text);


除了解决方案1,请阅读,
In addition to the Solution 1, please read,

  • Beginners Introduction to State Management Techniques in ASP.NET[^]
  • ASP.NET State Management Overview[^]
  • ASP.NET State Management Recommendations[^]


这篇关于在ASP.NET中使用C Sharp的附加概念的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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