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? 3 10557
Kevin,
The Eval method returns an object, which you can call ToString on and
then call substring on:
<%# Eval("description").ToString().Substring(0, 50) %>
Or, assuming description is a string field (and you know this), you
could just cast:
<% ((string) Eval("description")).Substring(0, 50) %>
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Kevin Blount" <ke**********@gmail.comwrote in message
news:a6**********************************@v4g2000h sf.googlegroups.com...
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?
"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.comwrote in
message news:uA**************@TK2MSFTNGP05.phx.gbl...
Kevin,
The Eval method returns an object, which you can call ToString on and
then call substring on:
<%# Eval("description").ToString().Substring(0, 50) %>
Or, assuming description is a string field (and you know this), you
could just cast:
<% ((string) Eval("description")).Substring(0, 50) %>
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com
"Kevin Blount" <ke**********@gmail.comwrote in message
news:a6**********************************@v4g2000h sf.googlegroups.com...
>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?
<asp:Label ID="defaultDescription" runat="server" Text='<%#
Eval("description") == null ? string.Empty : ((string)
Eval("description")).Substring(0, 50) %>
just to be on the safe side :P
Mythran
On Nov 30, 10:49 am, "Mythran" <kip_pot...@hotmail.comwrote:
"Nicholas Paldino [.NET/C# MVP]" <m...@spam.guard.caspershouse.comwrote in
messagenews:uA**************@TK2MSFTNGP05.phx.gbl. ..
Kevin,
The Eval method returns an object, which you can call ToString on and
then call substring on:
<%# Eval("description").ToString().Substring(0, 50) %>
Or, assuming description is a string field (and you know this), you
could just cast:
<% ((string) Eval("description")).Substring(0, 50) %>
--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com
"Kevin Blount" <kevin.blo...@gmail.comwrote in message
news:a6**********************************@v4g2000h sf.googlegroups.com...
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?
<asp:Label ID="defaultDescription" runat="server" Text='<%#
Eval("description") == null ? string.Empty : ((string)
Eval("description")).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......
|
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...
|
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"...
|
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...
|
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...
|
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":
...
|
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='<%#...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
| |