Subject: Image web server control
Posted By: keyvanjan Post Date: 1/14/2006 6:53:22 AM
Hi,
I have an aspx page.It has a form and a page load sub.
in the form I have:
 <asp:image id="img1" runat="server" />

Now in the page load event I want to access the imageURL and width and height properties programatically.
what should I do?
I write this but it does not work
img1.width="100"
    img1.imageURL="www.d.com" target="_blank">http://wwww.d.com"

Reply By: Imar Reply Date: 1/14/2006 7:15:46 AM
Can you define "but it does not work"? Do you get an error?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: keyvanjan Reply Date: 1/14/2006 8:57:07 AM
I get this error
 System.NullReferenceException: Object reference not set to an instance of an object.

Reply By: Imar Reply Date: 1/14/2006 8:59:48 AM
In that case, can you post the code for the page?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: keyvanjan Reply Date: 1/14/2006 9:54:22 AM
Here is the code:
I get this error:
 Value of type 'String' cannot be converted to 'System.Web.UI.WebControls.Unit'
<%@ Page Language="VB" AutoEventWireup="True" %>
<%@ import namespace="system.web.ui" %>
<script runat="server">
sub page_load(sender as object,e as eventargs)

img1.width="3"
'img1.imageURL="http://www.d.com"
end sub
</script>
<html>
 <body>
  
 
 <form runat=server>
 
 <asp:image id="img1" runat="server" />
 </form>
 
 </body>
 </html>


Reply By: Imar Reply Date: 1/14/2006 10:25:54 AM
That's a different error than the one you posted earlier, and an error that can be fixed by looking at the Width property of the WebControl class in the MSDN documentation (your best friend for these kind of questions):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebuiwebcontrolswebcontrolclasswidthtopic.asp

The Width is not a simple string, but a Unit. So, instead of assigning something like "100", give it a unit, like this: new Unit(100)

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply By: keyvanjan Reply Date: 1/14/2006 11:11:30 AM


<%@ Page Language="VB" Debug="true" %>
<%@ import Namespace="System.Data" %>
<%@ import Namespace="System.Data.Oledb" %>
<%@ import Namespace="System.web.UI.Webcontrols" %>
<%@ import Namespace="System.Web.UI" %>
<%@ OutputCache Duration="30" VaryByParam="CatID"%>

<script runat="server">
'++++++++++++++++++++++++++++++++++++++++++++
  'Handle page load event
  Public  intWidth as integer
  Public intHeight as integer
  Public intPageSize1 as integer
  Public ImgFolder as string
  Public img1 as System.Web.UI.WebControls.Image
  
  Function fixBirthDate(sItem) as String
if sItem is System.DBNull.Value Then
    fixBirthDate="test"
else
    fixBirthDate=sItem
End If
End function

  
  Sub Page_Load(Sender As Object, E As EventArgs)  
     
       'img1.width=New Unit(100, UnitType.Pixel)
    img1.imageURL="http://localhost/winxp.gif"
    'img1.visible="True"
    
    strSQL = "SELECT * from setting"
    Dim  objDataReader as OledbDataReader
    objConnection = New OledbConnection(strConnection)
    objCommand = New OledbCommand(strSQL, objConnection)
    objConnection.Open()
    objDataReader  = objCommand.ExecuteReader()
  
    
While  objDataReader.Read()
  intWidth= objDataReader("imageWidth")
  intHeight= objDataReader("imageHeight")
  intPageSize1=objDataReader("pagesize")
  strCharSet=objDataReader("charset")
  ImgFolder=objDataReader("imageFolder")
  
  strBgColor=objDataReader("BgColor")
  strLinksColor=objDataReader("LinksColor")
  strHLinksColor=objDataReader("HLinksColor")
  strVLinksColor=objDataReader("VLinksColor")
  strScroll=objDataReader("scrollbar")
  strTextFont=objDataReader("textFont")
 End While
    
                 objDataReader.Close()   
             
         'Call newest links   
         Newest_Links()

         Most_Popular_Links()

         Sort_Category_Links()
        
         Display_Letter_Links()

         Choose_Category_Menu()

         Get_Cat_Name()


         Check_OrderBy_AscDesc()

         LinkAndLabel_TextDisplay()
       
     

         'Check if not postback, set the page size to 10 records per page and bind and display data
         If Not Page.IsPostBack Then       

            intPageSize.text = intPageSize1
            intCIndex.text = "0"
          
            BindList()
        
         End If
     
  End Sub
'++++++++++++++++++++++++++++++++++++++++++++

Public  Sub setting()
         

 End Sub


'++++++++++++++++++++++++++++++++++++++++++++

'Page level error handling - If the page encounter an error, redirect to the custom error page
  ' Protected Overrides Sub OnError(ByVal e As System.EventArgs)

   '  Server.Transfer("error.aspx")

 '  End Sub
'++++++++++++++++++++++++++++++++++++++++++++


'+++++++++++++++++++++++++++++++++++++++++++++++
'Display the alphabetical letter listing depending what tab has been view
  Sub Display_Letter_Links()

     iTabnumber = request("tab")
     Dim i as Integer
     Dim cid as integer = request("subid")
     Dim cat as integer = request("catid")
     Dim isid as integer = request("sid")
    
 Select Case iTabnumber

   Case "1"

      lblalphaletter.Text = string.empty
      for i = 65 to 90    
  lblalphaletter.text = lblalphaletter.text & "<a href=""newsList.aspx?tab=" & iTabnumber & "&catid=" & cat & "&subid=" & cid & "&lb=" & chr(i) & chr(34) & " class=""letter"" title="& chr(i) & ">" & chr(i) &  "</a>&nbsp;&nbsp;"
      next

   Case "2"

      lblalphaletter.Text = string.empty
      for i = 65 to 90    
         lblalphaletter.text = lblalphaletter.text & "<a href=""newsList.aspx?tab=2&l=" & chr(i) & chr(34) & " class=""letter"" title="& chr(i) & ">" & chr(i) &  "</a>&nbsp;&nbsp;"
      next

   Case "3"
      
      lblalphaletter.Text = string.empty
      for i = 65 to 90    
  lblalphaletter.text = lblalphaletter.text & "<a href=""newsList.aspx?tab=" & iTabnumber & "&sid=" & isid & "&lc=" & chr(i) & chr(34) & " class=""letter"" title="& chr(i) & ">" & chr(i) &  "</a>&nbsp;&nbsp;"
      next

  End Select

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Display left Panel Category menu
 Sub Choose_Category_Menu()
         
strSQL = "SELECT *, (SELECT COUNT (*)  FROM News WHERE News.CATID = CATEGORY.CATID AND Active = True) AS REC_COUNT FROM CATEGORY ORDER BY CATNAME ASC"

         'Call Open database - connect to the database
         DBconnect()

         Dim LinkAdapter as New OledbDataAdapter(objCommand)
         Dim dts as New DataSet()
         LinkAdapter.Fill(dts, "CATID")

         CategoryName.DataSource = dts.Tables("CATID").DefaultView
         CategoryName.DataBind()

         'Close database
         objConnection.Close()

 End Sub
 
 
'++++++++++++++++++++++++++++++++++++++++++++




'++++++++++++++++++++++++++++++++++++++++++++
 'Display 15 newest Links
 Sub Newest_Links()
         
  strSQL= "Select TOP 10 Date,NewsID,Headline,Hits  From  ( Select TOP 10 date,NewsID,Headline,Hits From News where active=True order By Date DESC   )"

         'Call Open database - connect to the database
         DBconnect()

         Dim LinkAdapter as New OledbDataAdapter(objCommand)
         Dim dts as New DataSet()
         LinkAdapter.Fill(dts, "NewsID")

         NewestLink.DataSource = dts.Tables("NewsID").DefaultView
         NewestLink.DataBind()

         'Close database connection
         objConnection.Close()

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
 'Display 15 most popular Links
 Sub Most_Popular_Links()
          
    If (CStr(Request.QueryString("tab")) = "1")  Then

        CategoryID = Request.QueryString("catid")


strSQL = "SELECT Top 10 NewsID,Headline,Hits FROM News WHERE CatID = " & Replace(CategoryID, "'", "''") & " AND Active = True Order By Hits DESC"

         Else

strSQL= "Select TOP 10 NewsID,Headline,Hits  From  ( Select TOP 10 date,NewsID,Headline,Hits From News where active=True  order By hits DESC  )"

    End if
  
         'Call Open database - connect to the database      
         DBconnect()

         Dim LinkAdapter as New OledbDataAdapter(objCommand)
         Dim dts as New DataSet()
         LinkAdapter.Fill(dts, "NewsID")

         PopularLinks.DataSource = dts.Tables("NewsID").DefaultView
         PopularLinks.DataBind()

        'Close database
        objConnection.Close()

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Bind our Data - this is where we bind the data through the conditional structure SQL statements
  Sub BindList()

        'Call custom sort and order parameter
        Sort_Order_Parameter()

        'Call SQL statements
        BindList_SQLStatements()

        'Call db connection string
        DBconnect()

        Dim LinkAdapter As New OledbDataAdapter(objCommand)
        Dim dts As New DataSet

        'Check if page is not postback, then display default
        If Not Page.IsPostBack Then
            LinkAdapter.Fill(dts)
            intRcdCount.text = CStr(dts.Tables(0).Rows.Count)
            dts = Nothing
            dts = New DataSet
        End If

        'Set our page size to 10 on default view
        Dim intPageSize2 As Integer = 10
        Dim intCIndex2 As Integer
        intCIndex2 = intCIndex.text

        LinkAdapter.Fill(dts, CInt(intCIndex2), CInt(intPageSize2), "NewsID")

        LinkCat.DataSource = dts.Tables(0).DefaultView

        LinkCat.DataBind()

        DisplayPageCount()

        TopBreadCrumb_Text()

        HideUnhide_Pager_Panel()

        'Close database
        objConnection.Close()

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'SQL Bind List statements
 Sub BindList_SQLStatements()

  iTabnumber = request("tab")
 
   Select Case iTabnumber

     Case "1"

        If Request.QueryString("lb") <> "" Then

           Dim Recletter as string
           Recletter = Request.QueryString("lb")

'SQL statement display Link A-Z depending the letter
strSQL = "SELECT *, (Rated/No_RATES) AS RATES From News WHERE CatID = " & Replace(CategoryID, "'", "''") & " AND Headline LIKE '" & Replace(Recletter, "'", "''") & "%' ORDER BY " & Replace(Linksqlorderby, "'", "''") & ""
         
        Else
         
'SQL statement display category
strSQL = "SELECT *, (Rated/No_RATES) AS Rates From News WHERE CatID = " & Replace(CategoryID, "'", "''") & " AND Active = True ORDER BY " & Replace(Linksqlorderby, "'", "''") & ""

        End if      

    Case "2"

         Dim Recletter as string
         Recletter = Request.QueryString("l")

'SQL statement display Link A-Z depending the letter
strSQL = "SELECT *, (Rated/No_RATES) AS RATES From News WHERE Headline LIKE '" & Replace(Recletter, "'", "''") & "%' ORDER BY " & Replace(Linksqlorderby, "'", "''") & ""
         
    Case "3"

       If Request.QueryString("lc") <> "" Then

         Dim Recletter as string
         Recletter = Request.QueryString("lc")

'SQL statement display Link A-Z depending the letter
strSQL = "SELECT *, (Rated/No_RATES) AS RATES From News WHERE Active = True AND Headline LIKE '" & Replace(Recletter, "'", "''") & "%' ORDER BY " & Replace(Linksqlorderby, "'", "''") & ""
         
         Else
         
'SQL statement display sort 50 most popular,rating,name asc and newest
strSQL = "SELECT TOP 50 *, (Rated/No_RATES) AS Rates From News Where Active = True ORDER BY " & Replace(Linksqlorderby, "'", "''") & ""

        End if
         
  End Select

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Display the pager link if the records are more than 10, otherwise hide the pager link
 Sub HideUnhide_Pager_Panel()

 'Check if the page has more 10 records and display the paging links
        Dim strCatcounts As Integer
        strCatcounts = intRcdCount.text

        If strCatcounts <= 10 Then

            Panel1.visible = False

        ElseIf strCatcounts > 10 Then

            Panel1.visible = True

        End If

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Display the top bread crumb links name and the record count
 Sub TopBreadCrumb_Text()

        'Display page name on the top page depending the tab #
        If request.querystring("tab") = "1" Then

            lblrcdcounttop.Text = "( " & intRcdCount.text & " )"
            lblcaption.text = strCaption

        ElseIf request.querystring("tab") = "2" Then

            lblbreadcrumdtop.text = "News starting with letter <b>" & request.querystring("l") & "</b>"
            lblrcdcounttop.Text = "( " & intRcdCount.text & " )"
            lblcaption.text = strCaption

        ElseIf request.querystring("tab") = "3" Then

            lblbreadcrumdtop.text = "Sorting News"
            lblcaption.text = strCaption & "&nbsp;<b>50</b> News"

        ElseIf request.querystring("tab") = "4" Then

            lblbreadcrumdtop.text = "50 Most Reviewed News"
            lblcaption.text = strCaption

        End If

        If request.querystring("tab") = "3" And request.querystring("lc") <> "" Then

            lblbreadcrumdtop.text = "Sorting Link"
            lblcaption.text = strCaption & "&nbsp;<b>50</b> News starting with letter&nbsp;<b>" & request.querystring("lc") & "</b>"

        End If

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Handles the sort and order parameter
  Sub Sort_Order_Parameter()

         CategoryID = Request.QueryString("catid")
      
         action = Request.QueryString("action")
         action = "DATE"
         orderby = "DESC"

        If Request.QueryString("sid") = "" Then
        action = "DATE"
            strCaption = ""

        ElseIf Request.QueryString("sid") = "1" Then
            action = "No_RATES"
            strCaption = "Sorted by: Highest Rated"

        ElseIf Request.QueryString("sid") = "2" Then
            action = "Hits"
            strCaption = "Sorted by: Most Popular"

        ElseIf Request.QueryString("sid") = "3" Then
            action = "DATE"
            strCaption = "Sorted by: Newest"

        ElseIf Request.QueryString("sid") = "4" Then
            action = "Headline"
            strCaption = "Sorted by: Name"       

       ElseIf Request.QueryString("sid") = "5" Then
             action = "headline"
            strCaption = "Sorted by: Most Reviewed"    

   End If
   
    'If order ASC or DESC equals blank then grab the default value
    If Request.QueryString("ob") <> "" Then
    orderby = Request.QueryString("ob")
    End If

      'Sort by whether Ascending or Descending
      If orderby = "1" Then
      orderby = "ASC"

        ElseIf orderby = "2" Then
       orderby = "DESC"

        ElseIf orderby > "2" Then
       orderby = "DESC"

     End If

      'Handles the custom sorting SQL statement
      sqlorderby = " " & action & " " & orderby
      Linksqlorderby = "Date"
      if (sqlorderby <> "") then Linksqlorderby = sqlorderby

  End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Conditionally Show an Item in a Bound List - Show popular text or new image depending the condition
  Sub LinkCat_ItemDataBound(sender As Object, e As DataListItemEventArgs)

     'First, make sure we're not dealing with a Header or Footer row
     If e.Item.ItemType <> ListItemType.Header AND e.Item.ItemType <> ListItemType.Footer then

       'Show PopularLabel for items where Hits > 2500
       Dim PopularLabel As Label = CType(e.Item.FindControl("lblpopular"), Label)
       Dim strPopular as Integer = DataBinder.Eval(e.Item.DataItem, "Hits")
       Dim handImage As Image = CType(e.Item.FindControl("thumb"), Image)

          If strPopular > 1500 Then

             handImage.ImageUrl = "images/hnd.gif"
             handImage.visible = true
             PopularLabel.visible = True
             PopularLabel.text = "Popular"

          End if

       'Show a newimage for items where items not older than 1 week
       Dim strDate as Date = DataBinder.Eval(e.Item.DataItem, "DATE")
       Dim Newimage As Image = CType(e.Item.FindControl("newimg"), Image)

       Dim DateSince as string
       
          DateSince = DateDiff("d", DateTime.Now, strDate) + 7
             
            If DateSince >= 0 Then

                 Newimage.ImageUrl = "images/new.gif"   

            Else

                Newimage.visible = False
               
            End If

    End if
 
  If e.Item.ItemType <> ListItemType.Header AND e.Item.ItemType <> ListItemType.Footer then

         Dim intCatID as integer
         Dim intSubID as integer
         Dim strLCatName as string
         Dim strLSubName as string

         intCatID = DataBinder.Eval(e.Item.DataItem, "CATID")

         Dim catnamelabel As Label = CType(e.Item.FindControl("lblcatname2"), Label)

Dim CmdCatName2 As New OleDbCommand("Select CATNAME From CATEGORY Where CATID=" & intCatID & "", New OleDbConnection(strConnection))
        CmdCatName2.Connection.Open()
        strLCatName = CmdCatName2.ExecuteScalar()
        catnamelabel.text = strLCatName
        CmdCatName2.Connection.Close()

        
 end if

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
 Sub LinkAndLabel_TextDisplay()

   iTabnumber = request("tab")

    Select Case iTabnumber

       Case "1"

         lblletter.Text = "&nbsp;A-Z:"

       Case "2"

         lblletter.Text = "All News Links A-Z:"
         lblCategoryNameFooter.text = "You are here in All News Alphabetical Listing"

       Case "3"

         lblletter.Text = "Sorted News A-Z:"
         lblCategoryNameFooter.text = "You are here in Quick Sort"
         
case else
response.end
     End select

         'Label for side panel header text
         lblsortcat.text = "Sort Option"  

         HyperLink1.NavigateUrl = "index.aspx"
         HyperLink1.Text = "Home"
         HyperLink1.ToolTip = "Back to Link homepage"

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Display record count,page number
  Sub DisplayPageCount()
     
       lblRecpage.Text = "Total News:<b>&nbsp;" & intRcdCount.text
       lblRecpage.Text += "</b> - Showing Page:<b> "
       lblRecpage.Text += CStr(CInt(CInt(intCIndex.text) / CInt(intPageSize.text)+1))
       lblRecpage.Text += "</b> of <b>"

     If (CInt(intRcdCount.Text) Mod CInt(intPageSize.text)) > 0 Then
       lblRecpage.Text += CStr(CInt(CInt(intRcdCount.text) / CInt(intPageSize.text)+1))
     Else
       lblRecpage.Text += CStr(CInt(intRcdCount.text) / CInt(intPageSize.text))
     End If
       lblRecpage.Text += "</b>"

  End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Jump to the first page - paging link
  Sub ShowFirst(ByVal s As Object, ByVal e As EventArgs)

       intCIndex.Text = "0"
       BindList()

  End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Back to previous page - paging link
  Sub ShowPrevious(ByVal s As Object, ByVal e As EventArgs)

     intCIndex.text = Cstr(Cint(intCIndex.text) - CInt(intPageSize.text))

      If CInt(intCIndex.text) < 0 Then
        intCIndex.Text = "0"
      End If

     BindList()

  End Sub
'++++++++++++++++++++++++++++++++++++++++++++
  


'++++++++++++++++++++++++++++++++++++++++++++
'Go to next page - paging link
  Sub ShowNext(ByVal s As Object, ByVal e As EventArgs)

    If CInt(intCIndex.text) + 1 < CInt(intRcdCount.text) Then
      intCIndex.text = CStr(CInt(intCIndex.text) + CInt(intPageSize.text))
    End If

    BindList()

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Jump to last page - paging link
  Sub ShowLast(ByVal s As Object, ByVal e As EventArgs)

      Dim itemp as Integer

      itemp = CInt(intRcdCount.text) Mod CInt(intPageSize.text)

        If itemp > 0 Then
          intCIndex.text = Cstr(CInt(intRcdCount.text) - itemp)
        Else
          intCIndex.text = Cstr(CInt(intRcdCount.text) - CInt(intPageSize.text))
       End If

       BindList()

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
  'Display category name in the breadcrum top link
  Sub Get_Cat_Name()

 if request("tab") = "1" then

 Dim CmdCatName As New OleDbCommand("Select CATNAME From CATEGORY Where CATID=" & request("catid") & "", New OleDbConnection(strConnection))
        CmdCatName.Connection.Open()
        lblCategoryName.Text = CmdCatName.ExecuteScalar()
        CmdCatName.Connection.Close()

 end if

  End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
  'Display sub-category name in the breadcrumb top link
  'Sub Get_SubCat_Name()

  'if request("tab") = "1" then

 'Dim CmdCatName As New OleDbCommand("Select SUBNAME From SUBCATEGORY Where SUBID=" & request("subid") & "", New OleDbConnection(strConnection))
    '    CmdCatName.Connection.Open()
    '    lblSubCatName.Text = CmdCatName.ExecuteScalar()
     '   CmdCatName.Connection.Close()

  'end if

  'End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Display sort option links -  Here we check what tab we are viewing, and then display the corresponding custom sort links
  Sub Sort_Category_Links()

    Dim iTabnumber as Integer = request("tab")

    Select case iTabnumber

        Case "1"

                Tab1_CustomSortLinks()

        Case "2"

                Tab2_CustomSortLinks()

        Case "3"

               Tab3_CustomSortLinks()

        Case "4"
     
               Tab4_CustomSortLinks()
case else
response.end
    End Select
     
 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
 Sub Tab1_CustomSortLinks()

      Dim strRecletter As String
      Dim strLb As String
      Dim strRflag as integer
      Dim CatIDS as integer
      strRflag = Request.QueryString("r")
      strRecletter = Request.QueryString("l")
      strSid = Request.QueryString("sid")
      strOB = Request.QueryString("ob")
      CategoryID = Request.QueryString("catid")
      CatIDS = Request.QueryString("catid")
      strLb = Request.QueryString("lb")

            LinkReset.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID
            LinkReset.Text = "Reset"
            LinkReset.ToolTip = "Back to Category default view"

            'Here we check what field are we going to sort, this depends the strSid value
            If strSid = "2" Then
            LinkMostPopular.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 2 & "&ob=" & 1 & "&r=" & 1
              LinkMostPopular.Text = "Most Popular"
              LinkMostPopular.ToolTip = "Sort Category by Most Popular Links ASC"
            Else
              LinkMostPopular.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 2 & "&ob=" & 2 & "&r=" & 2
              LinkMostPopular.Text = "Most Popular"
              LinkMostPopular.ToolTip = "Sort Category by Most Popular Links DESC"

                'Check the strSid value and hide arrow up and arrow down image
                If strSid <> 2 Then

                    ArrowImage2.visible = False

                End If

            End If

            'Check if both values are true, and change the url depending on the values
            If strSid = "2" And strOB = "1" Then

             LinkMostPopular.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 2 & "&ob=" & 2 & "&r=" & 2
             LinkMostPopular.Text = "Most Popular"
             LinkMostPopular.ToolTip = "Sort Category by Most Popular Links DESC"
             ArrowImage2.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "2" And strOB = "2" Then

                ArrowImage2.ImageUrl = "images/arrow_down.gif"

            End If

             'We check if we are dealing with alphabet letter sorting
            If strLb <> "" AND strRflag = "1" Then

             LinkMostPopular.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 2 & "&ob=" & 2 & "&r=" & 2
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort by Most Popular Links DESC"
                ArrowImage2.ImageUrl = "images/arrow_up.gif"

            Elseif strLb <> "" AND strRflag = "2" Then

             LinkMostPopular.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 2 & "&ob=" & 1 & "&r=" & 1
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort by Most Popular Links ASC"
                ArrowImage2.ImageUrl = "images/arrow_down.gif"

            ElseIf  strLb <> "" Then

                LinkMostPopular.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 2 & "&ob=" & 2 & "&r=" & 2
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort Category by Most Popular Links DESC"
                'ArrowImage2.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "1" Then
              LinkHighestRated.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 1 & "&ob=" & 1 & "&r=" & 1
              LinkHighestRated.Text = "Highest Rated"
              LinkHighestRated.ToolTip = "Sort Category by Highest Rated Links ASC"
            Else
              LinkHighestRated.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 1 & "&ob=" & 2 & "&r=" & 2
              LinkHighestRated.Text = "Highest Rated"
              LinkHighestRated.ToolTip = "Sort Category by Highest Rated Links DESC"

                If strSid <> 1 Then

                    ArrowImage.visible = False

                End If

            End If


            If strSid = "1" And strOB = "1" Then

              LinkHighestRated.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb &"&sid=" & 1 & "&ob=" & 2 & "&r=" & 2
              LinkHighestRated.Text = "Highest Rated"
              LinkHighestRated.ToolTip = "Sort Category by Highest Rated Links DESC"
                ArrowImage.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "1" And strOB = "2" Then

                ArrowImage.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "3" Then
                NewestLinkest.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 3 & "&ob=" & 1 & "&r=" & 1
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort Category by Newest Links ASC"
            Else
                NewestLinkest.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 3 & "&ob=" & 2 & "&r=" & 2
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort Category by Newest Links DESC"

                If strSid <> 3 Then

                    ArrowImage3.visible = False

                End If

            End If


            If strSid = "3" And strOB = "1" Then

                NewestLinkest.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 3 & "&ob=" & 2 & "&r=" & 2
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort Category by Newest Links DESC"
                ArrowImage3.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "3" And strOB = "2" Then

                ArrowImage3.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "4" Then
                LinkName.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 4 & "&ob=" & 1 & "&r=" & 1
                LinkName.Text = "Headline"
                LinkName.ToolTip = "Sort Category by Link Name ASC"
            Else
                LinkName.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&lb=" & strLb & "&sid=" & 4 & "&ob=" & 2 & "&r=" & 2
                LinkName.Text = "Name"
                LinkName.ToolTip = "Sort Category by Link Name DESC"

                If strSid <> 4 Then

                    ArrowImage4.visible = False

                End If

            End If


            If strSid = "4" And strOB = "1" Then

                LinkName.NavigateUrl = "newsList.aspx?tab=1&catid=" & CatIDS & "&subid=" & CategoryID & "&sid=" & 4 & "&ob=" & 2 & "&r=" & 2
                LinkName.Text = "Name"
                LinkName.ToolTip = "Sort Category by News Headline DESC"
                ArrowImage4.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "4" And strOB = "2" Then

                ArrowImage4.ImageUrl = "images/arrow_down.gif"

            End If

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
 Sub Tab2_CustomSortLinks()

      Dim strRecletter As String
      Dim strRflag as integer
      strRecletter = Request.QueryString("l")
      strSid = Request.QueryString("sid")
      strOB = Request.QueryString("ob")

            LinkReset.visible = False

            If strSid = "2" Then
                LinkMostPopular.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 2 & "&ob=" & 1
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort by Most Popular Links ASC"
            Else
                LinkMostPopular.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 2 & "&ob=" & 2
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort by Most Popular Links DESC"

                If strSid <> 2 Then

                    ArrowImage2.visible = False

                End If

            End If


            If strSid = "2" And strOB = "1" Then

                LinkMostPopular.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 2 & "&ob=" & 2
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort by Most Popular Links DESC"
                ArrowImage2.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "2" And strOB = "2" Then

                ArrowImage2.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "1" Then
                LinkHighestRated.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 1 & "&ob=" & 1
                LinkHighestRated.Text = "Highest Rated"
                LinkHighestRated.ToolTip = "Sort by Highest Rated Links ASC"
            Else
                LinkHighestRated.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 1 & "&ob=" & 2
                LinkHighestRated.Text = "Highest Rated"
                LinkHighestRated.ToolTip = "Sort by Highest Rated Links DESC"

                If strSid <> 1 Then

                    ArrowImage.visible = False

                End If

            End If


            If strSid = "1" And strOB = "1" Then

                LinkHighestRated.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 1 & "&ob=" & 2
                LinkHighestRated.Text = "Highest Rated"
                LinkHighestRated.ToolTip = "Sort by Highest Rated Links DESC"
                ArrowImage.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "1" And strOB = "2" Then

                ArrowImage.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "3" Then
                NewestLinkest.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 3 & "&ob=" & 1
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort by Newest Links ASC"
            Else
                NewestLinkest.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 3 & "&ob=" & 2
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort by Newest Links DESC"

                If strSid <> 3 Then

                    ArrowImage3.visible = False

                End If

            End If


            If strSid = "3" And strOB = "1" Then

                NewestLinkest.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 3 & "&ob=" & 2
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort by Newest Links DESC"
                ArrowImage3.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "3" And strOB = "2" Then

                ArrowImage3.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "4" Then
                LinkName.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 4 & "&ob=" & 1
                LinkName.Text = "Name"
                LinkName.ToolTip = "Sort by Link Name ASC"
            Else
                LinkName.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 4 & "&ob=" & 2
                LinkName.Text = "Name"
                LinkName.ToolTip = "Sort by Link Name DESC"

                If strSid <> 4 Then

                    ArrowImage4.visible = False

                End If

            End If


            If strSid = "4" And strOB = "1" Then

                LinkName.NavigateUrl = "newsList.aspx?tab=2&l=" & strRecletter & "&sid=" & 4 & "&ob=" & 2
                LinkName.Text = "Name"
                LinkName.ToolTip = "Sort by Link Name DESC"
                ArrowImage4.ImageUrl = "images/arrow_down.gif"

            End If

            If strSid = "4" And strOB = "2" Then

                ArrowImage4.ImageUrl = "images/arrow_up.gif"

            End If

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
 Sub Tab3_CustomSortLinks()

      strSid = Request.QueryString("sid")
      strOB = Request.QueryString("ob")

            ArrowImage.visible = False
            ArrowImage2.visible = False
            LinkReset.visible = False

            If strOB = "1" Then
                LinkName.NavigateUrl = "newsList.aspx?tab=3&sid=" & strSid & "&ob=" & 1
                LinkName.Text = "Ascending"
                LinkName.ToolTip = "Sort by Ascending"
                ArrowImage3.ImageUrl = "images/arrow_up.gif"
            Else
                LinkName.NavigateUrl = "newsList.aspx?tab=3&sid=" & strSid & "&ob=" & 1
                LinkName.Text = "Ascending"
                LinkName.ToolTip = "Sort by Ascending"
                ArrowImage3.ImageUrl = "images/arrow_up.gif"

            End If

            If strOB = "2" Then

                NewestLinkest.NavigateUrl = "newsList.aspx?tab=3&sid=" & strSid & "&ob=" & 2
                NewestLinkest.Text = "Descending"
                NewestLinkest.ToolTip = "Sort by Descending"
                ArrowImage4.ImageUrl = "images/arrow_down.gif"
            Else

                NewestLinkest.NavigateUrl = "newsList.aspx?tab=3&sid=" & strSid & "&ob=" & 2
                NewestLinkest.Text = "Descending"
                NewestLinkest.ToolTip = "Sort by Descending"
                ArrowImage4.ImageUrl = "images/arrow_down.gif"

            End If

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
 Sub Tab4_CustomSortLinks()

      Dim strRecletter As String
      strRecletter = Request.QueryString("l")
      strSid = Request.QueryString("sid")
      strOB = Request.QueryString("ob")


            If strSid = "2" Then
                LinkMostPopular.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 2 & "&ob=" & 1
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort by Most Popular Links ASC"
            Else
                LinkMostPopular.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 2 & "&ob=" & 2
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort by Most Popular News DESC"

                If strSid <> 2 Then

                    ArrowImage2.visible = False

                End If

            End If


            If strSid = "2" And strOB = "1" Then

                LinkMostPopular.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 2 & "&ob=" & 2
                LinkMostPopular.Text = "Most Popular"
                LinkMostPopular.ToolTip = "Sort by Most Popular News DESC"
                ArrowImage2.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "2" And strOB = "2" Then

                ArrowImage2.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "1" Then
                LinkHighestRated.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 1 & "&ob=" & 1
                LinkHighestRated.Text = "Highest Rated"
                LinkHighestRated.ToolTip = "Sort by Highest Rated News ASC"
            Else
                LinkHighestRated.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 1 & "&ob=" & 2
                LinkHighestRated.Text = "Highest Rated"
                LinkHighestRated.ToolTip = "Sort by Highest Rated Newss DESC"

                If strSid <> 1 Then

                    ArrowImage.visible = False

                End If

            End If


            If strSid = "1" And strOB = "1" Then

                LinkHighestRated.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 1 & "&ob=" & 2
                LinkHighestRated.Text = "Highest Rated"
                LinkHighestRated.ToolTip = "Sort by Highest Rated News DESC"
                ArrowImage.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "1" And strOB = "2" Then

                ArrowImage.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "3" Then
                NewestLinkest.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 3 & "&ob=" & 1
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort by Newest Links ASC"
            Else
                NewestLinkest.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 3 & "&ob=" & 2
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort by Newest Links DESC"

                If strSid <> 3 Then

                    ArrowImage3.visible = False

                End If

            End If


            If strSid = "3" And strOB = "1" Then

                NewestLinkest.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 3 & "&ob=" & 2
                NewestLinkest.Text = "Newest"
                NewestLinkest.ToolTip = "Sort by Newest News DESC"
                ArrowImage3.ImageUrl = "images/arrow_up.gif"

            End If

            If strSid = "3" And strOB = "2" Then

                ArrowImage3.ImageUrl = "images/arrow_down.gif"

            End If


            If strSid = "4" Then
                LinkName.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 4 & "&ob=" & 1
                LinkName.Text = "Name"
                LinkName.ToolTip = "Sort by Link Name ASC"
            Else
                LinkName.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 4 & "&ob=" & 2
                LinkName.Text = "Name"
                LinkName.ToolTip = "Sort by Link Name DESC"

                If strSid <> 4 Then

                    ArrowImage4.visible = False

                End If

            End If


            If strSid = "4" And strOB = "1" Then

                LinkName.NavigateUrl = "newsList.aspx?tab=4&l=" & strRecletter & "&sid=" & 4 & "&ob=" & 2
                LinkName.Text = "Name"
                LinkName.ToolTip = "Sort by news headline DESC"
                ArrowImage4.ImageUrl = "images/arrow_down.gif"

            End If

            If strSid = "4" And strOB = "2" Then

                ArrowImage4.ImageUrl = "images/arrow_up.gif"

            End If

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'++++++++++++++++++++++++++++++++++++++++++++
'Display label order by ASC or Desc
  Sub Check_OrderBy_AscDesc()

     strOB = Request.QueryString("ob")

     Select case strOB

        Case "1"

           lblOrderBy.text = "&nbsp;Order By Ascending"
           ArrowImage5.ImageUrl = "images/arrow_down.gif"
           ArrowImage6.visible = false

        Case "2"

           lblOrderBy.text = "&nbsp;Order By Descending"
           ArrowImage6.ImageUrl = "images/arrow_up.gif"
           ArrowImage5.visible = false

     End Select

     If Request.QueryString("ob") = "" Then

         ArrowImage5.visible = false
         ArrowImage6.visible = false

     End if

      Dim strLb as string
      strLb = Request.QueryString("lb")

     If strLb <> "" Then

        lblSortedLetter.text = "starting with letter&nbsp;<b>" & strLb & "</b>&nbsp;"

     End if

  End Sub
'++++++++++++++++++++++++++++++++++++++++++++








'++++++++++++++++++++++++++++++++++++++++++++
'Database connection string
 Sub DBconnect()

     objConnection = New OledbConnection(strConnection)
     objCommand = New OledbCommand(strSQL, objConnection)

 End Sub
'++++++++++++++++++++++++++++++++++++++++++++



'+++++++++++++++++++++++++++++++++++++++++++++++++
   'Declare public so it will accessible in all subs  
    Public strDBLocation = DB_Path()
    Public strConnection as string = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBLocation
    Public objConnection
    Public objCommand
    Public strSQL as string
    Public iRandomLink as integer
    Public CategoryID as Integer
    Public action as string
    Public orderby as string
    Public sortname as string
    Public Linksqlorderby as string
    Public sqlorderby as string
    Public strCaption as string
    Public strSearchSQL as string
    Public strSid as integer
    Public strOB as integer
    Public iTabnumber as integer

'++++++++++++++++++++++++++++++++++++++++++++

</script>

<!--#include file="common.aspx"-->
<!--#include file="inc_header.aspx"-->

<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="16%" align="left" valign="top" rowspan="4">
<!--#include file="menu.aspx"-->
<!--Begin Display Category Menu-->
<div class="roundcont">
<div class="roundtop">
<img src="images/hleft.gif" height="5" width="5" alt="" class="corner">
<div class="dcnt"><span class="content3">Choose Category</span></div>
</div>
</div>
<div class="contentdisplay">
<div class="contentdis5">
<asp:DataList cssClass="hlink" id="CategoryName" runat="server">
   <ItemTemplate>
<div class="dcnt2">
<a class="dt" title="Go to <%# DataBinder.Eval(Container.DataItem, "CATNAME") %> category" href='<%# DataBinder.Eval(Container.DataItem, "CATID", "newsList.aspx?catid={0}&tab=1") %>'><%# DataBinder.Eval(Container.DataItem, "CATNAME") %></a> <span class="catcntsml">(<%# DataBinder.Eval(Container.DataItem, "REC_COUNT") %>)</span>
</div>
   </ItemTemplate>
  </asp:DataList>
</div>
</div>    
<!--End Display Category Menu-->
</td>
    <td width="68%" valign="top" align="left">
<!--#include file="inc_searchtab.aspx"-->
<div style="margin-left: 10px; margin-top: 0; margin-right: 12px;  background-color: #FFFAF4;">
&nbsp;&nbsp;<asp:HyperLink tooltip="Back to Link homepage" id="HyperLink1" cssClass="dtcat" runat="server" />&nbsp;<span class="bluearrow"></span>&nbsp;<a class="dtcat" href="newsList.aspx?catid=<%=request("catid")%>"><asp:Label runat="server" id="lblCategoryName" /></a>&nbsp;</span>&nbsp;<asp:Label runat="server" cssClass="content10" id="lblSubCatName" /><asp:Label cssClass="content10" runat="server" id="lblbreadcrumdtop" /> <asp:Label runat="server" cssClass="catcntsml" id="lblrcdcounttop" />
</div>
<div style="margin-left: 16px;">
<asp:Label cssClass="content2" ID="lblrcdcount" runat="server" />&nbsp;&nbsp;<asp:Label cssClass="content2" ID="lblcaption" runat="server" /> <asp:Label id="lblSortedLetter" cssClass="content2" runat="server" /> <asp:Label id="lblOrderBy" cssClass="content2" runat="server" /> <asp:Image id="ArrowImage5" runat="server" /><asp:Image id="ArrowImage6" runat="server" />
</div>
<div style="padding: 2px; text-align: center; border: 1px dashed #C4DBFF; margin-bottom: 14px; margin-top: 10px; margin-left: 26px; margin-right: 26px;">
<asp:Label cssClass="corange" runat="server" id="lblletter" />
<asp:Label id="lblalphaletter" font-name="verdana" font-size="9" runat="server" />
</div>
</td>
    <td width="16%" valign="top" align="left" rowspan="4">

<br />
<!--#include file="inc_pop.aspx"-->
<br />
<!--#include file="inc_new.aspx"-->
<form runat="server" style="margin-top: 0px; margin-bottom: 0px;">
</td>
  </tr>
  <tr>
    <td width="66%" valign="top" align="left">
<div style="margin-left: 5px; margin-right: 5px;">
<table border="0" cellpadding="0" cellspacing="0" width="100%">
  <tr>
    <td width="100%" align="right">
<!--Begin sort category links-->
<div class="divsort">
<img src="images/trcorner.gif" alt="" class="corner">
<div style="text-align: center; height: 16px;">
<asp:Label class="sortcat" runat="server" id="lblsortcat" />:
<asp:HyperLink id="LinkMostPopular" cssClass="dt" runat="server" /> <asp:Image id="ArrowImage2" runat="server" /> |
<asp:HyperLink id="LinkHighestRated" cssClass="dt" runat="server" /> <asp:Image id="ArrowImage" runat="server" /> |
<asp:HyperLink id="NewestLinkest" cssClass="dt" runat="server" /> <asp:Image id="ArrowImage3" runat="server"  /> |
<asp:HyperLink id="LinkName" cssClass="dt" runat="server" /> <asp:Image id="ArrowImage4" runat="server" /> | <asp:HyperLink id="LinkReset" cssClass="dt" runat="server" />
</div>
</div>
<!--End sort category links-->
</td>
  </tr>
  <tr>
    <td width="100%">
<!--Begin display Links center content-->
<asp:DataList width="98%" id="LinkCat" OnItemDataBound="LinkCat_ItemDataBound" RepeatColumns="1" runat="server">
      <ItemTemplate>
    <div >
       <div class="divhd">
<span class="bluearrow">»</span>&nbsp;
<a class="dtcat2" title="" href='<%# DataBinder.Eval(Container.DataItem, "NewsID", "viewNews.aspx?id={0}") %>' ><%# DataBinder.Eval(Container.DataItem, "headline") %></a> <asp:Label ID="lblpopular" cssClass="hot" runat="server" /> <asp:Image ID="newimg" runat="server" /> <asp:Image ID="thumb" AlternateText ="Thumbs up" runat="server" visible="false" />
</div>
<div class="divbd">
<div class="divlink2">
<a class="dt5" title="Homepahe" href="index.aspx">Home</a>&nbsp;»&nbsp;<a class="dt5" title="Go to category" href="newsList.aspx?catid=<%# DataBinder.Eval(Container.DataItem, "CATID") %>&tab=1"><asp:Label ID="lblcatname2" runat="server" /></a>&nbsp;»&nbsp;<a title="" class="dt5" href="newsList.aspx?tab=1&catid=<%# DataBinder.Eval(Container.DataItem, "CATID") %>><asp:Label ID="lblsubname2" runat="server" /></a>
</div>
<div style="padding-top: 1px; padding-bottom: 3px; padding-left: 6px;">
<span class="descrip"></span> <asp:image id="img1" runat="server" />
<%# DataBinder.Eval(Container.DataItem, "short_News") %></div>
<div style="padding-top: 1px; padding-bottom: 2px; padding-left: 6px;">
<span class="content12">
<strong>Hits:</strong> <span class="cmaron3"><%# DataBinder.Eval(Container.DataItem, "Hits") %></span> &nbsp;|&nbsp;
<strong>Rating:</strong>&nbsp;<img src="images/<%# FormatNumber((DataBinder.Eval(Container.DataItem, "Rates")), 1,  -2, -2, -2) %>.gif" style="vertical-align: middle;" alt="Rating <%# FormatNumber((DataBinder.Eval(Container.DataItem, "Rates")), 1, -2, -2, -2) %>">&nbsp;( <%# FormatNumber((DataBinder.Eval(Container.DataItem, "Rates")), 1, -2, -2, -2) %> ) by <%# DataBinder.Eval(Container.DataItem, "No_RATES") %> users</span>
</div>
<div style="padding-top: 1px; padding-bottom: 2px; padding-left: 6px;">
<span class="content12">
<strong>Added:</strong> <span class="cmaron3"><%# FormatDateTime(DataBinder.Eval(Container.DataItem, "DATE"),vbShortDate) %></span>&nbsp;|&nbsp;<a class="dt5" title="Email <%# DataBinder.Eval(Container.DataItem, "Headline") %> News to friend" href="JavaScript:openWindow('tell_a_friend.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;n=<%# DataBinder.Eval(Container.DataItem, "headline") %>')">Email Link</a>&nbsp;|&nbsp;<a title="Read / Write a Review on <%# DataBinder.Eval(Container.DataItem, "NewsID") %> link" class="dt5" href="viewNews.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>">Read review </a>
</span>
</div>
<div style="padding-top: 1px; padding-bottom: 2px;">
<span class="content12"><strong>&nbsp;&nbsp;Rate News:</strong>&nbsp;</span>
<ul class='srating'>
  <li><a href='#' onclick="javascript:top.document.location.href='ratelink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=1';" title='Not sure - 1 star' class='onestar'>1</a></li>
  <li><a href='#' onclick="javascript:top.document.location.href='ratelink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=2';" title='Fair - 2 stars' class='twostars'>2</a></li>
  <li><a href='#' onclick="javascript:top.document.location.href='ratelink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=3';" title='Interesting - 3 stars' class='threestars'>3</a></li>
  <li><a href='#' onclick="javascript:top.document.location.href='ratelink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=4';" title='Very good - 4 stars' class='fourstars'>4</a></li>
  <li><a href='#' onclick="javascript:top.document.location.href='ratelink.aspx?id=<%# DataBinder.Eval(Container.DataItem, "NewsID") %>&amp;rateval=5';" title='Excellent - 5 stars' class='fivestars'>5</a></li>
</ul>
   </div>
  </div>
</div>

      </ItemTemplate>
  </asp:DataList>
</td>
  </tr>
</table>
</div>

</td>
  </tr>
  <tr>
    <td width="68%" valign="top" align="left">
<!--Begin Record count,page count and paging link-->
<div style="margin-left: 1px;">















<table border="0" cellpadding="0" cellspacing="0" align="center" width="98%">
  <tr>
  <td align="left" bgcolor="#E8F1FF" width="2%" height="23" background="images/lcircle.gif">
&nbsp;
</td>
    <td align="left" bgcolor="#E8F1FF" height="23" width="48%">
<asp:label ID="lblRecpage"
  Runat="server"
  cssClass="content2" />
<asp:label ID="intCIndex"
  Visible="False"
  Runat="server"
cssClass="content2" />
<asp:label ID="intPageSize"
  Visible="False"
  Runat="server"
  cssClass="content2" />
<asp:label ID="intRcdCount"
  Visible="False"
  Runat="server"
  cssClass="content2" />
</td>
    <td align="right" bgcolor="#E8F1FF" height="23" width="44%">
<asp:Panel ID="Panel1" runat="server">
<span class="content2">
<a title="Back to Previous Page" href="category.aspx#this"
  ID="PreviousPage"
  onserverclick="ShowPrevious"
  runat="server"
  class="dt">&laquo; Previous</a>&nbsp;|&nbsp;
<a title="Jump to First Page" href="category.aspx#this"
  ID="FirstPage"
  onserverclick="ShowFirst"
  runat="server"
  class="dt">&laquo; First</a>&nbsp;|&nbsp;
<a title="Jump to Last Page" href="category.aspx#this"
  ID="LastPage"
  onserverclick="ShowLast"
  runat="server"
  class="dt">Last &raquo;</a>&nbsp;|&nbsp;
<a title="Jump to Next Page" href="category.aspx#this"
  ID="NextPage"
  onserverclick="ShowNext"
  runat="server"
  class="dt">Next &raquo;</a>&nbsp;&nbsp;&nbsp;
</span>
</asp:Panel>
</td>
    <td align="right" valign=top height="23" width="2%">
<div style="background: #E8F1FF url(images/rcircle.gif) no-repeat right; display: block; height: 23px;"></div>
</td>
  </tr>
</table>
</form>
</div>
<!--End Record count,page count and paging link-->
</td>
  </tr>
  <tr>
    <td width="68%" valign="top" align="left">
<br />
<div style="text-align: center;"><asp:Label id="lblCategoryNameFooter" cssClass="content2" runat="server" /></div>
</td>
  </tr>
</table>
<br />
<!--#include file="inc_footer.aspx"-->

Reply By: Imar Reply Date: 1/14/2006 11:36:53 AM
Heuh??????

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Big Night Out by Fun Lovin' Criminals (Track 12 from the album: 100% Colombian) What's This?
Reply By: keyvanjan Reply Date: 1/14/2006 12:24:00 PM
what????

Reply By: keyvanjan Reply Date: 1/14/2006 12:43:21 PM
I noticed sth.because <asp:image id="img1" runat="server" /> is located in <itemTemplate in a datalist server control I got that error message.
when I put it outside of datalist block the problem is solved.
Now what should I do?I want it to be in datalist.!!!!!

Reply By: Imar Reply Date: 1/14/2006 1:04:43 PM
I posted Heuh?????? because you posted a zillion lines of code without asking a question.

I don't hope you expect us to wade through all this code and try to find the question ourselves that you may have? You have to help us help you.

That said, if you need to access an image in a DataList, you need to get a reference to it. You can do this in the control's ItemCreated or ItemDataBound events. Inside these events, use FindControl("YourControlId") on e.Item (passed as an argument) to find the appropriate image and then cast it to an Image object.

Search this forum using the terms:

ItemCreated FindControl DataList

and you'll find a number of useful posts.

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Here is the atom bomb (Alt.) by The Smashing Pumpkins (Track 14 from the album: Machina II: Friends and Enemies of Modern Music) What's This?

Go to topic 38724

Return to index page 395
Return to index page 394
Return to index page 393
Return to index page 392
Return to index page 391
Return to index page 390
Return to index page 389
Return to index page 388
Return to index page 387
Return to index page 386