Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old April 19th, 2005, 08:06 AM
Registered User
 
Join Date: Apr 2005
Location: Wuhan, Hubei, China.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to lsxx
Default how to bind a data()

Hi everyone!
How can we bind a data which is selected from a database to a control(not datagrid ,datalist or repeater) such as a Label or a Linkbutton control ?
for example,if I want to bind a picture to the linkbutton control,and the picture is stored in a database,so how shall I do?

Thanks in advance!


Candle
  #2 (permalink)  
Old April 19th, 2005, 08:22 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Chennai, TamilNadu, India.
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

You cant bind data from database to Label or LinkButton control.

  #3 (permalink)  
Old April 19th, 2005, 02:36 PM
Imar's Avatar
Wrox Author
Points: 70,322, Level: 100
Points: 70,322, Level: 100 Points: 70,322, Level: 100 Points: 70,322, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Quote:
quote:Originally posted by Santhi
 You cant bind data from database to Label or LinkButton control.
You can't???

What about something like this:

<asp:Label id="lblTest" runat="server" Text='<%# SomeDatabindingExpression %>' />

Wouldn't that bind the results of SomeDatabindingExpression to the label?

Candle, are you trying to display a blob from the database, or did you store the *path* to the image in the database?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
  #4 (permalink)  
Old April 20th, 2005, 02:01 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Chennai, TamilNadu, India.
Posts: 326
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to Santhi Send a message via MSN to Santhi
Default

Sorry Candle,as imar said you can bind data for label controls using databinding expression.But we can't directly bind as we do in DataGrid,DataList or repeater controls.You can put the database related operations in function and return the whatever value you want to bind to label control using <%#%>..

  #5 (permalink)  
Old April 20th, 2005, 02:35 AM
Registered User
 
Join Date: Apr 2005
Location: Wuhan, Hubei, China.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to lsxx
Default

thanks!
I did store the path of the image in the database,but cannot bind it to the linkbutton's imageurl property.maybe i can use a function.

Candle


Similar Threads
Thread Thread Starter Forum Replies Last Post
How ti bind data in dropdownlist? aaronabdiel ASP.NET 2.0 Basics 1 February 11th, 2008 09:28 PM
Beginner :: Need help to bind the data in GridView kajal ASP.NET 2.0 Basics 2 April 2nd, 2007 01:21 AM
Beginner :: Need help to bind the data in GridView kajal Visual Studio 2005 2 March 31st, 2007 04:26 PM
How to Bind Data in DataGrid akumarp2p C# 2005 2 December 30th, 2006 12:11 PM
How to bind data from a recordset to a combobox? wayne62682 Access VBA 6 April 2nd, 2006 08:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.