Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / New Users / March 2006

Tip: Looking for answers? Try searching our database.

programming a Datalist

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
sameer - 20 Mar 2006 17:59 GMT
Hi All,
Environment: ASP.Net , framework 1.1, VS2003. Database: Sql server 2000

I have an MS DATALIST which has Item Templates, show the image and the price
right next to the "PRICE" text. the image name and the Price is being
populated from the datbase. All i do it get a datatable frm the database and
set it to the datasource of the grid it autoppulates it. The code in the HTML
section of the page for the grid which tells what fields are to be writen and
where to write them is :

<HeaderTemplate>
</HeaderTemplate>

<ItemTemplate>
<TABLE height=126 width=194 border=0>
<TR>
<TD><IMG height=136 src='<%# DataBinder.Eval(Container.DataItem,
"ProductImage") %>'></TD>
<TD class="plaintext">PRICE : '<%# DataBinder.Eval(Container.DataItem,
"price") %>'>
</TR>
</TABLE>
</ItemTemplate>

Now i want to add another field in their from the datatable which will haev
the sale price, and if their is a sale price for an item only then the Class
prperty of the PRICE Value should be "StiredNormalText" so that the price is
striked out and the the Sale price should appear benath it, once again if
their is no saleprice for an item then the CLASS of the Lable only for that
item should be "plaintext" and if their is then it should be
"StiredNormalText". their coudl be multuple records in the datatable. how can
i do this, can it be done? Please suggest.  

Sameer
Michael Nemtsev - 20 Mar 2006 19:55 GMT
Hello Sameer,

If I understand you correctly, you need to dynamically create your cell's
controls on ItemDataBound event

S> Hi All, Environment: ASP.Net , framework 1.1, VS2003. Database: Sql
S> server 2000
S>
S> I have an MS DATALIST which has Item Templates, show the image and
S> the price right next to the "PRICE" text. the image name and the
S> Price is being populated from the datbase. All i do it get a
S> datatable frm the database and set it to the datasource of the grid
S> it autoppulates it. The code in the HTML section of the page for the
S> grid which tells what fields are to be writen and where to write them
S> is :
S>
S> <HeaderTemplate>
S> </HeaderTemplate>
S> <ItemTemplate>
S> <TABLE height=126 width=194 border=0>
S> <TR>
S> <TD><IMG height=136 src='<%# DataBinder.Eval(Container.DataItem,
S> "ProductImage") %>'></TD>
S> <TD class="plaintext">PRICE : '<%#
S> DataBinder.Eval(Container.DataItem,
S> "price") %>'>
S> </TR>
S> </TABLE>
S> </ItemTemplate>
S> Now i want to add another field in their from the datatable which
S> will haev the sale price, and if their is a sale price for an item
S> only then the Class prperty of the PRICE Value should be
S> "StiredNormalText" so that the price is striked out and the the Sale
S> price should appear benath it, once again if their is no saleprice
S> for an item then the CLASS of the Lable only for that item should be
S> "plaintext" and if their is then it should be "StiredNormalText".
S> their coudl be multuple records in the datatable. how can i do this,
S> can it be done? Please suggest.
S>
S> Sameer
S>
---
WBR,
Michael  Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsch

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.