TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Mike Simo
NA
17
12.4k
Show image from table
Jul 2 2014 9:46 PM
Hi
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();
}
}
and here is aspx code:
<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>
Reply
Answers (
3
)
Must declare the scalar variable
Problem in installing SQL Server 2008 R2 management studio