473,888 Members | 1,816 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Applying formating to <%# DataBinder.Eval (Container.Data Item, "some_field ")%> statements

Hi:

Is it possible to apply formatting to above statements which insert field
values into HTML when binding to a datasource using Repeater control? For
example, I would like to trim trailing spaces. Also, I have tried things
like this, but can't get them to work:

<%# DataBinder.Eval (Container.Data Item, "lname") +
((DataBinder.Ev al(Container.Da taItem, "some_field")== "")?"":", ") +
DataBinder.Eval (Container.Data Item, "fname")%>

I would like to apply a little logic to these statements to clean up
formatting. Can some one show me how or some examples?

Thanks,
Charlie

Nov 18 '05 #1
1 2298
It might be simpler to pass lname and fname into a helper function that
would return the string in the format that you want. Here's the idea:

<asp:templateco lumn headertext="Pro ductID">
<itemtemplate >
<asp:Label runat="server" Text='<%#
fixit(DataBinde r.Eval(Containe r, "DataItem.Produ ctID")) %>'>
</asp:label>
</itemtemplate>
</asp:templatecol umn>

Here's how my function looks in VB:

Public Function fixit _
(ByVal intID As Integer) As String
If intID = 10 Then
Return "message" & intID.ToString
Else
Return "message"
End If

"Charlie@CB FC" <ch*****@comcas t.net> wrote in message
news:%2******** ********@tk2msf tngp13.phx.gbl. ..
Hi:

Is it possible to apply formatting to above statements which insert field
values into HTML when binding to a datasource using Repeater control? For
example, I would like to trim trailing spaces. Also, I have tried things
like this, but can't get them to work:

<%# DataBinder.Eval (Container.Data Item, "lname") +
((DataBinder.Ev al(Container.Da taItem, "some_field")== "")?"":", ") +
DataBinder.Eval (Container.Data Item, "fname")%>

I would like to apply a little logic to these statements to clean up
formatting. Can some one show me how or some examples?

Thanks,
Charlie


Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
411
by: Lauchlan M | last post by:
Hi In my aspx page HTML I have <a href='<%# DataBinder.Eval(Container.DataItem, "Name") %>'> <%# DataBinder.Eval(Container.DataItem, "Name") %> I am trying to create a hyperlink to applicationroot\FileUploads\Filename.FileExtension.
2
1388
by: Mark | last post by:
Hello Can anyone explain what the "#" does in a DataGrid template column like <%# DataBinder.Eval(Container, "DataItem.Phone") % I don't see anything about it in the MSDN help Thanks Mar
1
7653
by: CJM | last post by:
I've copied (& modified) some code from MSDN which uses a Repeater control, but I'm getting an error: Unexpected end of file looking for </HeaderTemplate> As far as I can see I've not made an dramatic changes, and if the MSDN code would work, I would also expect mine to work. As far as the </HeaderTemplate> tag is concerned, I removed it and replaced it - but it did not appear in the Intellisense list.
1
2639
by: Ed West | last post by:
Am getting this error with the following code, particularly this line: <%# Check(DataBinder.Eval(Container.DataItem, "broker_id"))%> I am creating checkboxes and the Check function checks to have that particular checkbox checked by default. I am not using checkboxlist because I want to EASILY save data to DB with a comma separated list which HTML gives you if all the checkboxes have the same name. <asp:datalist id=DataList1...
0
1175
by: info | last post by:
I have a datalist with ItemTemplate as a part of my control, however every time the ItemTemplate repeats, it inserts a <br>. How do I get it to not insert a <br>? I need it to be a DataList as opposed to a repeater so that I have access to the OnUpdateCommand. <asp:Panel id="DetailsPanel" runat="server"> <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0"> <TR><TD><DIV align="center"><FONT color="black"...
5
1900
by: ad | last post by:
I find there are some tag like <%= %> and <%# > in my .aspx file. What is the diffreence between <%= %> and <%# %>
4
2225
by: Satya | last post by:
Hi all, The following code is throwing a run time error "The server tag is not well formed. " <ItemTemplate> <asp:HyperLink Runat="server" ID="lnkFile" NavigateUrl="javascript:OpenImage('<%# DataBinder.Eval(Container.DataItem,"FileName") %>');"><%#
3
2789
by: webserverpete | last post by:
I would like to have multiple <td> in a repeater control. The below code does not work: <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" DataMember="DefaultView"> <HeaderTemplate> <table> </HeaderTemplate> <tr> <ItemTemplate> <td>
3
2776
by: | last post by:
I have been researching articles on google on how to create a simple RSS feed that sucks <title><blurb><link><date> out of a sql server 2000 database via an aspx page. I know it has to be pushed into a <xml> document but not sure which direction to take. Is there perhaps a starter document which uses sql server as the data source I can tap into.
0
9959
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
9800
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10772
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10880
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7144
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5812
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
6012
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
4241
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3246
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.