Hi all
i am facing a problem as my list view not showing any result, in the index page of my application i have SrchtxtBox which query string will be created depending on text entering and then passed to another page which is adsdetail.aspx. here is the code on textbox in the index page:
Response.Redirect("SearchResult.aspx?Searchfor=" + Srchtxt.Text);
and here is the code of my listview on adsdetail.aspx which not showing any result:
if (!IsPostBack)
{
string result = Convert.ToString(Request.QueryString["Searchfor"]);
if (Request.QueryString["Searchfor"] != null)
{
HttpCookie cookie = Request.Cookies.Get("Location");
if (cookie["Location"] != null)
{
using (SqlConnection srchsql = new SqlConnection(sc))
{
srchsql.Open();
SqlDataAdapter DAsearch = new SqlDataAdapter("SELECT [AdsID], [AdsDate], [AdsPrice], [AdsTit], SUBSTRING([AdsDesc],1,50) as AdsDesc, [Section], [Category], [Wtags], [Country], [State], [City],[Img1] FROM [ads] WHERE (([Country] = @Country) AND ([Wtags] = @Wtags))", sc);
DataSet DSsrchP = new DataSet();
DAsearch.SelectCommand.Parameters.AddWithValue("@Country", cookie.Value);
DAsearch.SelectCommand.Parameters.AddWithValue("@Wtags", result);
DAsearch.Fill(DSsrchP);
resultshowlistview.DataSource = DSsrchP.Tables[0];
resultshowlistview.DataBind();
}
}
else
{
}
}
}