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.dataitem 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=Microsoft.jet.OLEDB.4.0; Data Source=" &
dbPath & ";"
Dim myConnd As New OleDbConnection(sConn)
Dim myAdapterd As New OleDbDataAdapter(SQLdata, myConnd)
myConnd.Open()
Try
myAdapterd.Fill(dDS)
DLdata.DataSource = dDS.Tables(0).DefaultView
DLdata.DataBind()
Finally
myConnd.Close()
End Try
========================================
'code on aspx page displaying list
<asp:DataList ID="DLdata" runat="server" cssclass="DLdatagrid">
<ItemStyle CssClass="DLdata" />
<ItemTemplate>
<img src="images/arrow.jpg" alt=""/> <a
href='pagedata.aspx?id=<%#DataBinder.Eval(Containe r.DataItem,
"id")%>'><%#DataBinder.Eval(Container.DataItem , "pagedata")%></a>
</ItemTemplate>
</asp:DataList> 2 1483
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.googlegr oups.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.dataitem 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=Microsoft.jet.OLEDB.4.0; Data Source=" & dbPath & ";"
Dim myConnd As New OleDbConnection(sConn) Dim myAdapterd As New OleDbDataAdapter(SQLdata, myConnd) myConnd.Open()
Try myAdapterd.Fill(dDS) DLdata.DataSource = dDS.Tables(0).DefaultView DLdata.DataBind() Finally myConnd.Close() End Try
======================================== 'code on aspx page displaying list
<asp:DataList ID="DLdata" runat="server" cssclass="DLdatagrid"> <ItemStyle CssClass="DLdata" /> <ItemTemplate> <img src="images/arrow.jpg" alt=""/> <a href='pagedata.aspx?id=<%#DataBinder.Eval(Containe r.DataItem, "id")%>'><%#DataBinder.Eval(Container.DataItem , "pagedata")%></a>
</ItemTemplate> </asp:DataList>
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.googlegr oups.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.dataitem 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=Microsoft.jet.OLEDB.4.0; Data Source=" & dbPath & ";"
Dim myConnd As New OleDbConnection(sConn) Dim myAdapterd As New OleDbDataAdapter(SQLdata, myConnd) myConnd.Open()
Try myAdapterd.Fill(dDS) DLdata.DataSource = dDS.Tables(0).DefaultView DLdata.DataBind() Finally myConnd.Close() End Try
======================================== 'code on aspx page displaying list
<asp:DataList ID="DLdata" runat="server" cssclass="DLdatagrid"> <ItemStyle CssClass="DLdata" /> <ItemTemplate> <img src="images/arrow.jpg" alt=""/> <a href='pagedata.aspx?id=<%#DataBinder.Eval(Containe r.DataItem, "id")%>'><%#DataBinder.Eval(Container.DataItem , "pagedata")%></a>
</ItemTemplate> </asp:DataList> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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,...
|
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...
|
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?
--
|
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...
|
by: coinjo |
last post by:
Is there any function to determine the length of an integer string?
|
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?...
|
by: Derty |
last post by:
Any way to limit the length of databound text on a datalist
itemtemplate?
|
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...
|
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...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |