protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
String Temp = txtbyCompanyorName.Text;
String Temp1 = Temp.Replace(" { ", "_");
Temp = Temp1.Replace(" } ", "_");
string[] arInfo = new string[4];
char[] splitter = { '_' };
arInfo = Temp.Split(splitter);
int n = Temp.IndexOf("_");
if (n != -1)
{
Session["abc1"] = ""; Session["abc2"] = ""; Session["abc3"] = "";
for (int x = 0; x < arInfo.Length; x++)
{
if (arInfo[0] != null)
Session["abc1"] = arInfo[0].ToString();
else
Session["abc1"] = null;
if (arInfo[1] != null)
Session["abc2"] = arInfo[1].ToString();
else
Session["abc2"] = null;
if (arInfo[2] != null)
Session["abc3"] = arInfo[2].ToString();
else
Session["abc3"] = null;
}
}
else
{
if (RadioButtonList1.SelectedItem.Text == "Company/Name")
{
Session["abc1"] = txtbyCompanyorName.Text;
Session["abc2"] = "";
}
if (RadioButtonList1.SelectedItem.Text == "Product/Services")
{
Session["abc2"] = txtbyCompanyorName.Text;
Session["abc1"] = "";
}
}
if (DropDownList1.SelectedItem.Text == "All Area")
{
Session["ByArea"] = "";
}
else
{
Session["ByArea"] = DropDownList1.SelectedItem.Text;
}
if (txtbyCompanyorName.Text == "")
{
lblmsg.Text = "Please enter the search text";
}
else
{
Database db = new Database();
string str = "select * from ABDatabase where (CompanyName like '" + Session["abc1"].ToString() + "%' and BusinessCategory like '%" + Session["abc2"].ToString() + "%' ) and Area like '%" + Session["ByArea"] + "%' order by CompanyName";
if (db.GetDataReaderQuery(str).Read())
{
Response.Redirect("Search.aspx");
}
else
{
lblmsg.Text = "Search result is not found, please try again";
}
}
}
-Neer
Neer, if this helps please login to Mark As Answer. | Alert Moderator