protected void Button1_Click(object sender, EventArgs e) { string TextPart = ""; bool flag = false; if (DropDownList1.SelectedItem.Value.Equals("0")) { if (FileUpload1.HasFile) { if (Path.GetExtension(FileUpload1.FileName) == ".txt") { FileUpload1.SaveAs(Server.MapPath("~/TxtFile/New.txt")); flag = true; } else { CustomValidator1.IsValid = false; flag = false; } } if (File.Exists(Server.MapPath("~/TxtFile/New.txt"))) { TextPart = File.ReadAllText(Server.MapPath("~/TxtFile/New.txt")); string path = Server.MapPath("~/TxtFile/New.txt"); } } else { TextPart = TextBox1.Text; flag = true; } if (flag) { WordManage wm = new WordManage(); string WordString = wm.RemoveSpecialSymbole(TextPart); DataTable dt = new DataTable(); dt = wm.checkcount(WordString); //GridView1.DataSource = dt; //GridView1.DataBind(); WordList = wm.setValue(dt); } }