c# - (webform) how can i get the value from 9 different textbox and post back the value follow by ascending -
this code webform(asp.net c#):
protected void button2_click(object sender, eventargs e) { int no1; int no2; int no3; int no4; int no5; int no6; int no7; int no8; int no9; no1 = int.parse(txt1.text); no2 = int.parse(txt2.text); no3 = int.parse(txt3.text); no4 = int.parse(txt4.text); no5 = int.parse(txt5.text); no6 = int.parse(txt6.text); no7 = int.parse(txt7.text); no8 = int.parse(txt8.text); no9 = int.parse(txt9.text); int[] = new int[] {no1,no2,no3,no4,no5,no6,no7,no8,no9 }; array.sort(a); foreach (var str in a) { messagebox.show(str.tostring()); //display in messagebox, want display 9 different textbox. }
i can display result in messagebox. can't display result 9 different textbox. how can find solution? thank output http://i.gyazo.com/a91f7ffef1d6d1fa7815890464df3082.png
txt1.text = a[0]; txt2.text = a[1]; txt3.text = a[2]; txt4.text = a[3]; txt5.text = a[4]; txt6.text = a[5]; txt7.text = a[6]; txt8.text = a[7]; txt9.text = a[8];
this should job, if understood correctly.
Comments
Post a Comment