I have top banner in my application which will show an image and i am using "location" session so first page of application allow user to chosse his country and then redirect him to the selected country page. what i am looking for to show each image on the spacific page depending on session. Here is my server code which is not working and the image its not appear
protected void Topbannerimgbtn_Click(object sender, EventArgs e)
{
var location = Convert.ToString(Session["location"]);
using (SqlConnection topbanner = new SqlConnection(sc))
{
topbanner.Open();
SqlDataAdapter DAtopban = new SqlDataAdapter("Select advimg from Adverttop WHERE ([Country] = @Country)", sc);
DataSet DStopban = new DataSet();
DAtopban.SelectCommand.Parameters.AddWithValue("@Country", location);
DAtopban.Fill(DStopban);
bannertoplstviw.DataSource = DStopban.Tables[0];
bannertoplstviw.DataBind();
}
}
<div class="bannertop">
<asp:ListView ID="bannertoplstviw" runat="server">
<ItemTemplate>
<asp:ImageButton ID="Topbannerimgbtn" runat="server" ImageUrl='<%# "/images/AdsImgs/" + Eval("advimg") %>' CausesValidation="false" />
</ItemTemplate>
</asp:ListView>
</div>