M
marcus.lecount
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
<aspataList ID="DLdata" runat="server" cssclass="DLdatagrid">
<ItemStyle CssClass="DLdata" />
<ItemTemplate>
<img src="images/arrow.jpg" alt=""/> <a
href='pagedata.aspx?id=<%#DataBinder.Eval(Container.DataItem,
"id")%>'><%#DataBinder.Eval(Container.DataItem, "pagedata")%></a>
</ItemTemplate>
</aspataList>
..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
<aspataList ID="DLdata" runat="server" cssclass="DLdatagrid">
<ItemStyle CssClass="DLdata" />
<ItemTemplate>
<img src="images/arrow.jpg" alt=""/> <a
href='pagedata.aspx?id=<%#DataBinder.Eval(Container.DataItem,
"id")%>'><%#DataBinder.Eval(Container.DataItem, "pagedata")%></a>
</ItemTemplate>
</aspataList>