473,387 Members | 1,481 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Limit asp:label Databinder.Eval characters displayed

Hello
I want to use the same data string (memo) to populate a "summary" asplabel. After the summary there would be a + "..." and a "see more..." link to the "complete" string contents - for the summary (e.g. aspLabel ID="lblSName" text=Databinder.Eval(Container.Dataitem,"Descripti on") Runat="server"aspLabel) I need to limit the number of characters displayed.

Any ideas?
Thanks
John

From http://www.developmentnow.com/g/8_20...ork-aspnet.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com
Nov 19 '05 #1
2 2711
try

string.Substring(0, length)

HTH

Elton Wang

"John" wrote:
Hello
I want to use the same data string (memo) to populate a "summary" asplabel. After the summary there would be a + "..." and a "see more..." link to the "complete" string contents - for the summary (e.g. aspLabel ID="lblSName" text=Databinder.Eval(Container.Dataitem,"Descripti on") Runat="server"aspLabel) I need to limit the number of characters displayed.

Any ideas?
Thanks
John

From http://www.developmentnow.com/g/8_20...ork-aspnet.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Nov 19 '05 #2
I would try in this line...

1) Bind the Memo to 2 Lables . Label1 will be the summary and Label2 will be
the full text.
2) Use javascript to hide Label1 and show Label2 onmouseover / onclick on
"+...See more" on Label1. Hide Label2 and Show Label1 onmouseout of Label2

to trim the text to summary , implement a function in code behind

protected string TrimMemo(string Memo)
{
string Summary = Memo.SubString(1,100);
Summary += "<A HREF='javascript:ShowL2HideL1();' > +...See more </A>"
return(Summary);
}

Then call it during databinding.

aspLabel ID="lblSName"
text=TrimMemo(Databinder.Eval(Container.Dataitem," Description"))
Runat="server"aspLabel
HTH

"John" wrote:
Hello
I want to use the same data string (memo) to populate a "summary" asplabel. After the summary there would be a + "..." and a "see more..." link to the "complete" string contents - for the summary (e.g. aspLabel ID="lblSName" text=Databinder.Eval(Container.Dataitem,"Descripti on") Runat="server"aspLabel) I need to limit the number of characters displayed.

Any ideas?
Thanks
John

From http://www.developmentnow.com/g/8_20...ork-aspnet.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com

Nov 19 '05 #3

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

Similar topics

3
by: Harry | last post by:
Hi, Can anyone tell me why the below code does not work. I dont get any errors, but nor does the Text for the asp:label get set. Thanks in advance as always H
5
by: Johnb41 | last post by:
I want an "order number" to be displayed more than once on my page. <script language="vb" runat="server"> ... dim ordernumber as string = "123456" page.databind() ... </script>
4
by: Jeronimo Bertran | last post by:
I am currently using databing to show on an asp:label the result of appending two database fields in the following way: <asp:label id=textAcknowledgedBy runat="server" Text='<%# DataBinder.Eval...
2
by: Peter Rilling | last post by:
Below is some code that I do not know why it does not work. Okay, as you can see it is simple HTML with two ASP:Label controls. Each label has some code that basically gets a string that will be...
2
by: tshad | last post by:
Is there another way to put labels on a page other than asp:label? I have been building a page where I use a label to display the calculated result of some imput. I do it using Javascript. But...
1
by: nospamjac | last post by:
Hi, Is there a way to update the text of an asp:label on a webform without refreshing the entire page? What is called by button clicks and other events that refresh a webform control? See the...
1
by: Jimmy | last post by:
Hi In my headertemplate I do not get the column like in the itemtemplate ( I am using the northwind db): <asp:datagrid id="DataGrid1" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute;...
1
by: maflatoun | last post by:
Hi, I have a datagrid and based on a condition I like to display either a asp:textbox or asp:label. How would I do that? I have the following <asp:TemplateColumn HeaderText="Qty">...
1
by: Steve Hershoff | last post by:
I'm using VS 2003, and need to extract the text from an asp label in my code-behind file. The label is part of a DataList's ItemTemplate. I've noticed that in my ascx file (we're using User...
3
by: Homer J. Simpson | last post by:
I have the following stored procedure: ALTER PROCEDURE . AS BEGIN SET NOCOUNT ON; SELECT COUNT(*) FROM QUICKNOTES END ....and the following data source in my .aspx file:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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$) { } ...
0
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
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 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.