Ja det kan jeg godt se, men det forstår jeg ikke, jeg har slet ikke lavet noget javascript på min mide.
her er alt min kode:
aspx siden:
<%@ Page Title="" Language="C#" Debug="true" SmartNavigation="true" MaintainScrollPositionOnPostback="true" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="udsendelser.aspx.cs" Inherits="udsendelser" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:Repeater ID="program" runat="server">
<ItemTemplate>
<div class="container_udsendelser">
<div class="container_udsendelser_txt">
<div id="dato_udsendelser"> <%# Eval("date", "{0:d}")%></div>
<span id="program_txt">
<%# Eval("tid", "{0:t}")%>
</span>
<span id="txt_udsendelser"> <%# Eval("txt")%></span>
<span id="link_udsendelser">
<%#
(Eval("titel").ToString().Length > 0) ? "<a href=\"viewpage.aspx?task=edit&id=" + Eval ("id").ToString() + "\">Læs mere...</a>" : ""
%>
</span>
</div>
</div>
<br />
<!--<a href="viewpage.aspx?task=edit&id=<%# Eval ("id") %>">Læs mere...</a>-->
</ItemTemplate>
</asp:Repeater>
</asp:Content>
cs siden:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
public partial class udsendelser : System.Web.UI.Page
{
SqlConnection objconn = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
SqlCommand objcmd = new SqlCommand();
protected void Page_Load(object sender, EventArgs e)
{
GetLinks();
if (Request.QueryString["task"] != null)
{
switch (Request.QueryString["task"].ToString())
{
case "edit":
//do
break;
}
}
}
private void GetLinks()
{
if (DateTime.Now.Hour > 3)
{
objcmd.Connection = objconn;
objcmd.CommandType = CommandType.Text;
objcmd.CommandText = "SELECT * FROM PROGRAM WHERE DATE >= convert(varchar, GETDATE()) AND DATE <= DATEADD(Month, 2, GETDATE()) ORDER BY date,tid ASC";
SqlDataReader reader = null;
objconn.Open();
reader = objcmd.ExecuteReader();
program.DataSource = reader;
program.DataBind();
objconn.Close();
}
else
{
objcmd.Connection = objconn;
objcmd.CommandType = CommandType.Text;
objcmd.CommandText = "SELECT * FROM PROGRAM WHERE (DATE >= convert(varchar, GETDATE()) OR (DATE <= DATEADD(Month, 2, GETDATE())) AND DATE = DATEADD(day, DATEDIFF(day, 0, GETDATE()), 0)) ORDER BY date,tid ASC";
SqlDataReader reader = null;
objconn.Open();
reader = objcmd.ExecuteReader();
program.DataSource = reader;
program.DataBind();
}
}
}
Kan du se hvad jeg mener, alt det som står hvis man trykker "vis kilde" det står da ikke i min kode.
Ved du så hvad der er gået galt her?
tak