Welcome to Dream.In.Code
Become an Expert!

Join 150,184 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 2,102 people online right now. Registration is fast and FREE... Join Now!




image binding

 
Reply to this topicStart new topic

image binding

sangeetha_11284
6 Nov, 2007 - 10:41 PM
Post #1

New D.I.C Head
*

Joined: 6 Nov, 2007
Posts: 3


My Contributions
CODE

in .aspx
<asp:DataList ID="dlst1" runat="server" CellPadding="0" RepeatColumns="4" >
           <ItemTemplate>
               <asp:Label ID="Label1" runat="server" Text='<%# bind("celebrity") %>'></asp:Label>
               <asp:ImageButton ID="imbtn1" runat="server" ImageUrl='<%# bind("imagename") %>' Height="75px" Width="75px" />
    </ItemTemplate>
       </asp:DataList>
in .aspx.cs
SqlDataAdapter ada = new SqlDataAdapter("select * from [tablename] where [condition], conn);
        conn.Open();
        DataSet ds = new DataSet();
        ada.Fill(ds);
        dlst1.DataSource = ds;
        dlst1.DataBind();

hi,
i have stored images in a seperate folder in the website project and only image names with extension are stored in the database column. so plz tell me how to link the folder and database to retriew the images when the condition is satisfied.its urgent so plz reply me.
User is offlineProfile CardPM
+Quote Post

Footsie
RE: Image Binding
6 Nov, 2007 - 11:53 PM
Post #2

D.I.C Regular
Group Icon

Joined: 20 Sep, 2007
Posts: 308



Thanked: 4 times
Dream Kudos: 50
My Contributions
I'm not really sure what problem you're having?

What errors do you get when you run this code?
What's not working?
User is online!Profile CardPM
+Quote Post

sangeetha_11284
RE: Image Binding
19 Nov, 2007 - 03:06 AM
Post #3

New D.I.C Head
*

Joined: 6 Nov, 2007
Posts: 3


My Contributions
hi thanks for replying. i wrote code for tht. now my problem is
i hv passed imageid from 1st page to second page and i hv stored imageid as iid0001,iid0002,etc.,..... as varchar in database in 2nd page i hv written code as

string imgid = Request.QueryString["imageid"];
SqlDataAdapter da = new SqlDataAdapter("select * from tbluploadphoto where imageid =" + imgid, conn1);
conn1.Open();
DataSet ds = new DataSet();
da.Fill(ds);// here i am getting invalid column name'iid0001'
if (ds.Tables[0].Rows.Count > 0)
{
imagepath = "~/PostedImages/";
string str = ds.Tables[0].Rows[0]["imagename"].ToString();
imagepath = imagepath + ds.Tables[0].Rows[0]["imagename"].ToString();
lblimgtitle.Text = ds.Tables[0].Rows[0]["title"].ToString();
}
conn1.Close();
Page.DataBind();
// int imgid = Convert.ToInt32(Request.QueryString["imageid"]);
}

so pls help me wht i want to change.
thnx in advance
User is offlineProfile CardPM
+Quote Post

sangeetha_11284
RE: Image Binding
19 Nov, 2007 - 03:40 AM
Post #4

New D.I.C Head
*

Joined: 6 Nov, 2007
Posts: 3


My Contributions
hi i got output
thanks
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 04:02AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month