TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Danish Habib
NA
694
244k
Dynamic News stroller one line
May 29 2015 6:08 AM
Dear I had static news scroller one liner which works fine and now i want to make it dynamic so that I have that code before
<ul id="js-news" class="js-hidden">
<li class="news-item" runat="server">
<h2>
Welcome to RBME Section!
</h2>
</li>
<li class="news-item">
<h2>
First draft of R&D protocols
</h2>
</li>
<li class="news-item">
<h2>
APPR PROCESS initiated
</h2>
</li>
<li class="news-item">
<h2>
CSP4 Core team constituted
</h2>
</li>
<li class="news-item">
<h2>
FIRST MER Network meeting is begin conducted
</h2>
</li>
<li class="news-item">
<h2>
IT Services You Desire Always waiting for you with Plan Pakistan (ITechsol.org)</h2>
</li>
</ul>
it works fine static content displays one by one now i want to make it dynamic so i placed a datalist inside my li and change the code as below
<ul id="js-news" class="js-hidden">
<li class="news_item" runat="server">
<asp:DataList ID="DataList1" runat="server"
RepeatLayout="Table">
<ItemTemplate>
<asp:Label ID="EventDescriptionLabel" runat="server" Text='<%# Eval("CP_Name") %>' />
<div class="clear">
</div>
</ItemTemplate>
</asp:DataList>
</li>
I also tried using code behind technique which is given below
Private Sub getEventImage()
Dim cnnResource As New SqlConnection(AppSettings("DbSqlPortal"))
' Dim lbl As Label = DirectCast(DataList1.FindControl("EventDescriptionLabel"), Label)
Dim _da As SqlDataAdapter
Dim _ds As DataSet
Dim scom As String = "SELECT CP_Name FROM [CountryPrograms]"
_da = New SqlDataAdapter(scom, cnnResource)
_ds = New DataSet()
_da.Fill(_ds)
If (_ds.Tables(0).Rows.Count > 0) Then
DataList1.DataSource = _ds
DataList1.DataBind()
For Each dr As DataRow In _ds.Tables(0).Rows
lbls.Text += dr("CP_Name").ToString()
Next
End If
End Sub
where i am getting value of lbls in datalist_itembound event using the findcontrol method to find the value of lable but I am seeing the first record again and again and my ul is not iterating on the database records??? any help
Reply
Answers (
1
)
How to Create crystal report having date from 1 to 30 column
ccrystal report in asp.net