473,805 Members | 1,995 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Set length of container

Hi to anyone out there that is taking the time to read this. I'm new to
..net and any help given is appreciated.

I am displaying a datalist on a page and I want to limit the length of
the returned container.datai tem that is displayed to 39 characters. How
do i do this in asp.net? I can do this in classic asp by using the
len() function, but i'm a bit stuck on how to do it in asp.net.

Thanks for any help you can give, my code is below.

=============== =============== ==========
'code behind creating list

Dim SQLdata As String
Dim dDS As New DataSet()
SQLdata = "SELECT id, pagedata FROM tblContent WHERE level6 =
'" & sLev6 & "'"
sConn = "Provider=Micro soft.jet.OLEDB. 4.0; Data Source=" &
dbPath & ";"

Dim myConnd As New OleDbConnection (sConn)
Dim myAdapterd As New OleDbDataAdapte r(SQLdata, myConnd)
myConnd.Open()

Try
myAdapterd.Fill (dDS)
DLdata.DataSour ce = dDS.Tables(0).D efaultView
DLdata.DataBind ()
Finally
myConnd.Close()
End Try

=============== =============== ==========
'code on aspx page displaying list

<asp:DataList ID="DLdata" runat="server" cssclass="DLdat agrid">
<ItemStyle CssClass="DLdat a" />
<ItemTemplate >
<img src="images/arrow.jpg" alt=""/>&nbsp;<a
href='pagedata. aspx?id=<%#Data Binder.Eval(Con tainer.DataItem ,
"id")%>'><%#Dat aBinder.Eval(Co ntainer.DataIte m, "pagedata") %></a>

</ItemTemplate>
</asp:DataList>

Jan 23 '06 #1
2 1505
the easiest way to do it is:

<%# left(DataBinder .Eval(Container .DataItem, "pagedata") , 39)%>

Karl

--
http://www.openmymind.net/

<ma************ @googlemail.com > wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hi to anyone out there that is taking the time to read this. I'm new to
.net and any help given is appreciated.

I am displaying a datalist on a page and I want to limit the length of
the returned container.datai tem that is displayed to 39 characters. How
do i do this in asp.net? I can do this in classic asp by using the
len() function, but i'm a bit stuck on how to do it in asp.net.

Thanks for any help you can give, my code is below.

=============== =============== ==========
'code behind creating list

Dim SQLdata As String
Dim dDS As New DataSet()
SQLdata = "SELECT id, pagedata FROM tblContent WHERE level6 =
'" & sLev6 & "'"
sConn = "Provider=Micro soft.jet.OLEDB. 4.0; Data Source=" &
dbPath & ";"

Dim myConnd As New OleDbConnection (sConn)
Dim myAdapterd As New OleDbDataAdapte r(SQLdata, myConnd)
myConnd.Open()

Try
myAdapterd.Fill (dDS)
DLdata.DataSour ce = dDS.Tables(0).D efaultView
DLdata.DataBind ()
Finally
myConnd.Close()
End Try

=============== =============== ==========
'code on aspx page displaying list

<asp:DataList ID="DLdata" runat="server" cssclass="DLdat agrid">
<ItemStyle CssClass="DLdat a" />
<ItemTemplate >
<img src="images/arrow.jpg" alt=""/>&nbsp;<a
href='pagedata. aspx?id=<%#Data Binder.Eval(Con tainer.DataItem ,
"id")%>'><%#Dat aBinder.Eval(Co ntainer.DataIte m, "pagedata") %></a>

</ItemTemplate>
</asp:DataList>

Jan 24 '06 #2
Thanks Karl, I can't believe i missed that. Why do i always miss the
obvious???
Thanks for taking the time to answer, I appreciate your help.
Karl Seguin [MVP] wrote:
the easiest way to do it is:

<%# left(DataBinder .Eval(Container .DataItem, "pagedata") , 39)%>

Karl

--
http://www.openmymind.net/

<ma************ @googlemail.com > wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hi to anyone out there that is taking the time to read this. I'm new to
.net and any help given is appreciated.

I am displaying a datalist on a page and I want to limit the length of
the returned container.datai tem that is displayed to 39 characters. How
do i do this in asp.net? I can do this in classic asp by using the
len() function, but i'm a bit stuck on how to do it in asp.net.

Thanks for any help you can give, my code is below.

=============== =============== ==========
'code behind creating list

Dim SQLdata As String
Dim dDS As New DataSet()
SQLdata = "SELECT id, pagedata FROM tblContent WHERE level6 =
'" & sLev6 & "'"
sConn = "Provider=Micro soft.jet.OLEDB. 4.0; Data Source=" &
dbPath & ";"

Dim myConnd As New OleDbConnection (sConn)
Dim myAdapterd As New OleDbDataAdapte r(SQLdata, myConnd)
myConnd.Open()

Try
myAdapterd.Fill (dDS)
DLdata.DataSour ce = dDS.Tables(0).D efaultView
DLdata.DataBind ()
Finally
myConnd.Close()
End Try

=============== =============== ==========
'code on aspx page displaying list

<asp:DataList ID="DLdata" runat="server" cssclass="DLdat agrid">
<ItemStyle CssClass="DLdat a" />
<ItemTemplate >
<img src="images/arrow.jpg" alt=""/>&nbsp;<a
href='pagedata. aspx?id=<%#Data Binder.Eval(Con tainer.DataItem ,
"id")%>'><%#Dat aBinder.Eval(Co ntainer.DataIte m, "pagedata") %></a>

</ItemTemplate>
</asp:DataList>


Jan 24 '06 #3

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

Similar topics

4
1527
by: F Da Costa | last post by:
Hi, Small question re the use of an Array. I'v got an array with x rowObjects in it. When i get it the type of the container is Array and i can get a hold of the objects just fine. owever, how do i get the length of the array? For container.length does not seem to work.
7
17881
by: Dica | last post by:
i've used the sample code from msdn to create an encyption/decryption assembly as found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnnetsec/html/SecNetHT10.asp i'm able to encrypt and then decrypt data okay as in the following code: // encrypt the data // Encryptor enc = new Encryptor(EncryptionAlgorithm.TripleDes); byte key = Encoding.ASCII.GetBytes("0123456789012345");
4
6254
by: David Bartosik - MS MVP | last post by:
If I have... <TD><%# DataBinder.Eval(Container.DataItem, "Print_name") %></TD> and I want to display only the first 12 characters of the "Print_name" data field, how is that done? --
5
3516
by: Brian Henry | last post by:
I have a messaging application that has a data grid with information like an email list would have (from, subject, time sent, size) but the subject could be very long in theory, and then it would word wrap.. the subject is a variable width column (resizes to fit space) while the others are fixed size... the problem is that i dont want the text to ever word wrap.. but truncate the visible subject to match the current cell width... (kinda...
13
3660
by: coinjo | last post by:
Is there any function to determine the length of an integer string?
6
2712
by: foreverbored75 | last post by:
Hello All! I am just learning c++ in school and I have the following question: Is there a way for the user to input the length of an array (console application) without using another variable? I made this program that finds the average of x number of numbers and stores the average in the last index of the array of the numbers. The other other variable I have is to determine the length of the array (totalNums). Is there a way to get...
4
2962
by: Derty | last post by:
Any way to limit the length of databound text on a datalist itemtemplate?
3
4069
by: Asterbing | last post by:
I want to know the length in pixels of a document embedded in a iframe. The way I go seems to work under IE but not under Firefox (about other browsers I'll see later). Here is my page for testing : 1) The page which will appear in the iframe is : <html> <head>
2
2607
by: Mike P | last post by:
I have a method that is returning a string which can be of any length. Once this string is returned I want to display it on screen in a label control. How can I make the label control's height and width be flexible so that it always fits the length of the string it contains? <asp:Label ID="lblSQL" runat="server" Height="600" Width="600" BackColor="blue" ForeColor="white" Font-Names="Verdana" Font-Size="Small"></asp:Label> protected...
0
9716
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
9596
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,...
1
10364
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
9182
agi2029
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...
0
6875
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
5541
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
5677
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3843
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3007
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.