i have a looping statement in in my homepage for news..
I have these codes..
Model :
Imports Microsoft.VisualBasic
Imports System.Data
Public Class ClassNewsConnection
Inherits ClassConnection
'Featured News for Home Page
Public Function NewsFeatureHome() As DataTable
Return ReadData("SELECT * FROM news WHERE newsFeature = '" & 1 & "' ORDER BY newsID DESC LIMIT 3 ")
End Function
End Class
Controller :
Public Class HomeController
Inherits Global.System.Web.Mvc.Controller
Private News As New ClassNewsConnection
Private Announcement As New ClassAnnouncementConnection
Private Process As New ClassHTML
Function Index() As ActionResult
Dim dNews As DataTable = News.NewsFeatureHome()
For dCount As Integer = 0 To dNews.Rows.Count - 1
dNews.Rows(dCount).Item("newsTitle") = Process.ToHTML(dNews.Rows(dCount).Item("newsTitle"))
dNews.Rows(dCount).Item("newsContent") = Process.ToHTML(dNews.Rows(dCount).Item("newsContent"))
Next
Return View(dData)
End Function
End Class
View :
<%@ Page Title="" Language="VB" MasterPageFile="~/Views/Shared/SiteMasterPage.Master" Inherits="System.Web.Mvc.ViewPage" %>
<%@ Import Namespace="System.Data" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Home
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<h2>Index</h2>
<div>
<label for="News">News</label>
<%Dim dNews As DataTable = ViewData.Model%>
<%Dim id As Integer%>
<%Dim dTitle As String%>
<%For dCount As Integer = 0 To dNews.Rows.Count - 1%>
<%Dim dContent As String = dNews.Rows(dCount).Item("newsContent")%>
<%id = dNews.Rows(dCount).Item("newsID")%>
<p>
<%dTitle = dNews.Rows(dCount).Item("newsTitle")%>
<%=Html.ActionLink(dTitle, "__________", New With {id}, DBNull.Value)%>
<img src='<%=Url.Content("~/NewsImages/" + dNews.Rows(dCount).Item("newsThumbnail")) %>' alt="" />
<%If dContent.Length > 100 Then%>
<%dContent = dContent.Substring(0, dContent.IndexOf("", 300)) & "..."%>
<%Else%>
<%dContent = dContent%>
<%End If%>
<%=Html.ActionLink("Read More", "__________", New With {id}, DBNull.Value)%>
</p>
<%Next%>
</div>
</asp:Content>
the for loop statement outputs different news from different controllers and views.. Example, the first output could render this page : Community/CommunityNews/7 the second output could render this page : Athletics/AthleticsNews/5 the third output could render this page : Programs/ProgramsNews/2
how would i make the code for the link to those pages? will i use javascript?the problem is, i'm not that so familiar with javascript :( help please.. thank you! thank you!