-
Notifications
You must be signed in to change notification settings - Fork 0
/
WebForm1.aspx.cs
62 lines (53 loc) · 1.8 KB
/
WebForm1.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
namespace EdgeEnergy
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(@"C:\Users\panmo\source\repos\EdgeEnergy\App_Data\XMLFile1.xml");
System.Xml.XmlElement root = doc.DocumentElement;
System.Xml.XmlNodeList lst = root.GetElementsByTagName("list");
foreach (System.Xml.XmlNode n in lst)
{
ListBox1.Items.Add(n.InnerText);
}
}
}
protected void btnLeft_Click(object sender, EventArgs e)
{
if (ListBox2.SelectedIndex != -1)
{
ListBox1.Items.Add(ListBox2.SelectedValue);
ListBox2.Items.Remove(ListBox2.SelectedValue);
}
}
protected void btnRight_Click(object sender, EventArgs e)
{
if (ListBox1.SelectedIndex != -1)
{
ListBox2.Items.Add(ListBox1.SelectedValue);
ListBox1.Items.Remove(ListBox1.SelectedValue);
}
}
protected void btnSubmit_Click(object sender, EventArgs e)
{
for (int i = 0; i < ListBox2.Items.Count; i++)
{
if ((i + 1) < ListBox2.Items.Count)
txtSubmit.Text += ListBox2.Items[i] + ",";
else
txtSubmit.Text += ListBox2.Items[i];
}
}
}
}