c# - remember button clicked -
I have the following code on the web page and I am trying to display the output in the list < P> 1 + 1 = 2
The problem I have is missing the operation button and adding the listbox to it. Current output
1 button alert 1 = 2
button to save is to click the last button
namespace Kailkupen {public partial class Default: System . Web .UI.Page {safety button Ad_klik (object sender, Iventaarjis e) {if (! Stringkaisnloaraititi (text boxes 1 text) and Stringkaisnlorakti (textbox 2. Text)) textbox 3. Text = (convert to INT 32 (TextBox1.Text) + Convert. ToInt32 (Textbox2.Text)). ToString (); Label3.Text = string.Empty; ViewState ["Last Button Clicktta"] = ButtonAd.ID; } Protected void Btnsb_kalik (object sender, Iventaarjis e) {if Stringkaisanelelakti (text boxes 1 text) and Stringkaisnlorekti (Text Box 2 Test)) textbox 3 text. (Convert .OIT 32 (text box 1 text) - convert toInt32 (Textbox2.Text)). ToString (); Label3.Text = string.Empty; ViewState ["LastButtonClatch"] = ButtonSub.ed; } Protected void button Mull-link (object sender, Iventaarjis e) {if Stringkaisanelelakti (text boxes 1 text) and Stringkaisnlorakti (Text Box 2 Test)) textbox 3 text. (Convert. OINT 32 (text box 1 text) * Convert. ToInt32 (Textbox2.Text)). ToString (); Label3.Text = string.Empty; ViewState ["LastButtonClatch"] = ButtonForm.ID; } Secure Zero ButtonDiv_Click (Object Sender, EventArgs E) {try.IsNullOrEmpty (TextBox1.Text) & amp; String. IsNullOrEmpty (TextBox2.Text)) TextBox3.Text = (Convert.ToInt32 (TextBox1. Text) / Convert. ToInt32 (Textbox2.Text)). ToString (); ViewState ["LastButtonClatch"] = ButtonDiv.ID; } Hold {if (Textbox2.Text == "0") {TextBox3.Text = string.Empty; Label3.Text = "You can not divide by 0, try the second number"; }}} Protected Zero Button Reset (Text Sender, EventArgs e) {TextBox1.Text = string.Empty; TextBox2.Text = string.Empty; TextBox3.Text = string.Empty; Label3.Text = string.Empty; } Secure Zero Button Alert (Object Sender, EventEurge E) {var Back ButtonClickClick = (String) ViewState ["Last Button Clickate"]; If (ListBox1.Items.Count & lt; 10) {ListBox1.Items.Add (Textbox1.Text + ("") + Last button + ("") + TextBox2.Text + ("") + ("=") + ("") + Text box 3. text); }}}}}
Try to use visual state. It is used to continue any state between requests.
Set it here
ViewState ["LastButt clickable"] = someButton.Id; Get it here
var lastButtonClicked = (string) ViewState ["LastButtonClicked"];
Comments
Post a Comment