开发者

How to Update the Value of an ASP.NET Textbox Control on a Click Event

I have three asp.net textbox and button on my asp.net webform

namely textbox1, textbox2, textbox3, button1

i want if integer value of textbox2 will be substracted from textbox1 then result will be displayed in textbox3 and textbox1 and textbox2 value will remain the same ....on buttonclick event ...

MY PROBLEM :

ya i know ... how to do that .... my actually problem w开发者_运维知识库as that ... when i click button the text in textbox1 and textbox2 and textbox3 will be disappear ... but it want it remains the same


You need to subscribe the Button.OnClientClick to an event handler that does something like textbox3.Text = (int.Parse(textbox1.Text)-int.Parse(textbox2.Text)).ToString();


Check whether you have enabled the "ViewState" for the controls or page. And confirm that you have no initialization for the text box value.


Are they dynamic controls? If yes, try to recreate them in page_load.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜