diff --git a/Practice/ValidWeb/Forma1-clear.aspx.cs b/Practice/ValidWeb/Forma1-clear.aspx.cs
new file mode 100644
index 0000000..10fc124
--- /dev/null
+++ b/Practice/ValidWeb/Forma1-clear.aspx.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Web;
+using System.Web.UI;
+using System.Web.UI.WebControls;
+
+namespace ValidWeb
+{
+ public partial class Forma1 : System.Web.UI.Page
+ {
+
+ protected void Button2_Click(object sender, EventArgs e)
+ {
+ Session.Clear();
+ for (int i = Table1.Rows.Count-1; i > 0; i--)
+ {
+ Table1.Rows.RemoveAt(i);
+ }
+ }
+ }
+}
diff --git a/Practice/ValidWeb/Forma1.aspx b/Practice/ValidWeb/Forma1.aspx
index 7652ff8..4b3ad5d 100644
--- a/Practice/ValidWeb/Forma1.aspx
+++ b/Practice/ValidWeb/Forma1.aspx
@@ -41,6 +41,9 @@
+
+
+
diff --git a/Practice/ValidWeb/Forma1.aspx.cs b/Practice/ValidWeb/Forma1.aspx.cs
index 1f22c44..9407e32 100644
--- a/Practice/ValidWeb/Forma1.aspx.cs
+++ b/Practice/ValidWeb/Forma1.aspx.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Text.RegularExpressions;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
@@ -45,10 +46,15 @@ namespace ValidWeb
protected void Button1_Click(object sender, EventArgs e)
{
string name = TextBox1.Text;
+ if (Regex.IsMatch(name, @"[^a-zA-Z]")) { return; }
+
string surname = TextBox2.Text;
+ if (Regex.IsMatch(surname, @"[^a-zA-Z]")) { return; }
+
string school = TextBox3.Text;
string age = DropDownList1.Text;
- string language = CheckBoxList1.sele;
+ string language = CheckBoxList1.SelectedValue;
+
string user = String.Join("|", name, surname, school, age, language);
if (Session["users"] == null) {
Session["users"] = user;
@@ -70,5 +76,7 @@ namespace ValidWeb
Table1.Rows.Add(row);
}
+
+
}
}
diff --git a/Practice/ValidWeb/Forma1.aspx.designer.cs b/Practice/ValidWeb/Forma1.aspx.designer.cs
index 7c1a3ff..2861f5e 100644
--- a/Practice/ValidWeb/Forma1.aspx.designer.cs
+++ b/Practice/ValidWeb/Forma1.aspx.designer.cs
@@ -185,6 +185,15 @@ namespace ValidWeb
///
protected global::System.Web.UI.WebControls.Button Button1;
+ ///
+ /// Button2 control.
+ ///
+ ///
+ /// Auto-generated field.
+ /// To modify move field declaration from designer file to code-behind file.
+ ///
+ protected global::System.Web.UI.WebControls.Button Button2;
+
///
/// Table1 control.
///