I'm putting a radG:GridTempla teColumn together (which is probably
irelevant), and within it I'm using a Label, as so:
<asp:Label ID="defaultDesc ription" runat="server" Text='<%#
Eval("descripti on") %>'></asp:Label>
Fo this Label, I'd like to only show the first 50 chars of the
"descriptio n", but I've no idea how to change the Eval to do this.. is
there a way? 3 10572
Kevin,
The Eval method returns an object, which you can call ToString on and
then call substring on:
<%# Eval("descripti on").ToString() .Substring(0, 50) %>
Or, assuming description is a string field (and you know this), you
could just cast:
<% ((string) Eval("descripti on")).Substring (0, 50) %>
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Kevin Blount" <ke**********@g mail.comwrote in message
news:a6******** *************** ***********@v4g 2000hsf.googleg roups.com...
I'm putting a radG:GridTempla teColumn together (which is probably
irelevant), and within it I'm using a Label, as so:
<asp:Label ID="defaultDesc ription" runat="server" Text='<%#
Eval("descripti on") %>'></asp:Label>
Fo this Label, I'd like to only show the first 50 chars of the
"descriptio n", but I've no idea how to change the Eval to do this.. is
there a way?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard .caspershouse.c omwrote in
message news:uA******** ******@TK2MSFTN GP05.phx.gbl...
Kevin,
The Eval method returns an object, which you can call ToString on and
then call substring on:
<%# Eval("descripti on").ToString() .Substring(0, 50) %>
Or, assuming description is a string field (and you know this), you
could just cast:
<% ((string) Eval("descripti on")).Substring (0, 50) %>
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"Kevin Blount" <ke**********@g mail.comwrote in message
news:a6******** *************** ***********@v4g 2000hsf.googleg roups.com...
>I'm putting a radG:GridTempla teColumn together (which is probably irelevant), and within it I'm using a Label, as so:
<asp:Label ID="defaultDesc ription" runat="server" Text='<%# Eval("descript ion") %>'></asp:Label>
Fo this Label, I'd like to only show the first 50 chars of the "description ", but I've no idea how to change the Eval to do this.. is there a way?
<asp:Label ID="defaultDesc ription" runat="server" Text='<%#
Eval("descripti on") == null ? string.Empty : ((string)
Eval("descripti on")).Substring (0, 50) %>
just to be on the safe side :P
Mythran
On Nov 30, 10:49 am, "Mythran" <kip_pot...@hot mail.comwrote:
"Nicholas Paldino [.NET/C# MVP]" <m...@spam.guar d.caspershouse. comwrote in
messagenews:uA* *************@T K2MSFTNGP05.phx .gbl...
Kevin,
The Eval method returns an object, which you can call ToString on and
then call substring on:
<%# Eval("descripti on").ToString() .Substring(0, 50) %>
Or, assuming description is a string field (and you know this), you
could just cast:
<% ((string) Eval("descripti on")).Substring (0, 50) %>
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard .caspershouse.c om
"Kevin Blount" <kevin.blo...@g mail.comwrote in message
news:a6******** *************** ***********@v4g 2000hsf.googleg roups.com...
I'm putting a radG:GridTempla teColumn together (which is probably
irelevant), and within it I'm using a Label, as so:
<asp:Label ID="defaultDesc ription" runat="server" Text='<%#
Eval("descripti on") %>'></asp:Label>
Fo this Label, I'd like to only show the first 50 chars of the
"descriptio n", but I've no idea how to change the Eval to do this.. is
there a way?
<asp:Label ID="defaultDesc ription" runat="server" Text='<%#
Eval("descripti on") == null ? string.Empty : ((string)
Eval("descripti on")).Substring (0, 50) %>
just to be on the safe side :P
Mythran- Hide quoted text -
- Show quoted text -
Thanks guys.. apprecaite the replies.
I ended up creating anew method, where i can do much more string
manipulation, then return the result. My ASPX page now uses <%#
getDescription( ) %(there I can replace chars, truncate the length,
search for "http://" and replace with "<a href='http://'" for example. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Grayson |
last post by:
I have a need for an "Eval" function and found the perfect sample
The problem is it doesn't like "IsDate" being fed into it.
Any Ideas? seems like a missing reference, but I can't figure it out...
PS Thanx to Peter Bromberg for providing the sample
http://www.eggheadcafe.com/articles/20030908.asp
Namespace PAB.Util
Public Class EvalProvider
Public Function Eval(ByVal vbCode As String) As Object
|
by: Mike |
last post by:
Is there an equivalent in VB.Net or C# of VBScript's "Eval" and "Execute"
statements?
Thanks,
Mike
|
by: Paul |
last post by:
I am using Visual Studio.net 2005 (and asp.net 2.0)
Let's say that in a Web Project, I have created a (Dataset?) called
SomeDataset.xsd.
On it I have a TableAdapter called SomeTableTableAdapter and a query called
GetSomeInfoQuery.
In an aspx page I used an ObjectDataSource, and chose as the business object
SomeDataSetTableAdapters.SomeTableTableAdapter, then the method
GetSomeInfoQuery.
On the aspx side of the page I have a have a...
|
by: Newish |
last post by:
Hi
Is it really not recommended to us Eval in databound controls as
follows:
<td><asp:TextBox id="BookTitle" Runat="Server"
Text='<%# Eval("BookTitle") %>'
Font-Size="8pt" Width="80px"/></td>
If so what is the alternative.
|
by: David Thielen |
last post by:
Hi;
Is there a way to do <%# switch (Eval("prop")) ... where the case statements
are the text to put on the page?
--
thanks - dave
david_at_windward_dot_net
http://www.windwardreports.com
| |
by: clintonG |
last post by:
Duh.
I tried several syntactical character combinations but I can't seem to
figure out the syntax to extend the use of <%# Eval("...") %when used
inline as a ToolTip so as to append pre-fixed and post-fixed text with the
data that is returned by the expression.
// Returns: Scott
ToolTip='<%# Eval("MiddleName") %>'
// Need: Clinton Scott Gallagher
|
by: Rick Mavrovik |
last post by:
Hi,
I am using repeater bound to a dataset.
Within the repeater I have got ItemTemplate in which I am displaying data by
using
Eval("DataFieldName").
Does anyone know how can I perform any calculation in ItemTemplate on the
bound data..For instance. I need to display an image based on some rule like
if Eval("ThisField") is greater than Eval("ThatField").
|
by: thaytu888888 |
last post by:
Here is my codes in aspx page:
<td colspan="2" class="main_menu" runat="server" onclick='toggleDisplay(<%#Eval("description")%>);'><%#Eval("description")%></td>
Here is in "View source":
onclick="toggleDisplay(<%#Eval("description")%>);">Administrator Functions</td>
When putting <%#Eval('description')%> in <td> tag, it understand & show the correct value, but when in onclick='toggleDisplay(<%#Eval("description")%>);'> it didn't...
|
by: Kevin Blount |
last post by:
I'm putting a radG:GridTemplateColumn together (which is probably
irelevant), and within it I'm using a Label, as so:
<asp:Label ID="defaultDescription" runat="server" Text='<%#
Eval("description") %>'></asp:Label>
Fo this Label, I'd like to only show the first 50 chars of the
"description", but I've no idea how to change the Eval to do this.. is
there a way?
|
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...
|
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,...
| |
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |