Home  >  Article  >  Web Front-end  >  Jquery announcement scrolling AJAX background gets data_jquery

Jquery announcement scrolling AJAX background gets data_jquery

WBOY
WBOYOriginal
2016-05-16 18:07:471069browse

aspx

Copy code The code is as follows:







<%--头部部分--%>
border="0">






















公告:













<%--头部部分结束--%>
后台Util/MainUtil.aspx.cs输出对应的 HTML 的数据
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace Web.Util
{
public partial class MainUtil : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
int k = int.Parse(Request["param"].ToString());
switch (k)
{
case 1:
toOne();
break;
case 2:
toTwo();
break;
default:
break;
}
}
catch { }
}
private void toOne()
{
try
{
string st = String.Empty;
string companyName = Request["nameparam"].ToString();
DataTable dt1 = DBUtility.DbHelperSQL.Query("select top(5) Title,Id from 公告表 where TypeId='2' And Creater='" companyName "'order by CreatTime desc").Tables[0];
for (int i = 0; i < dt1.Rows.Count; i )
{
//把公告做成超链接
st = "
  • " dt1.Rows[i]["Title"].ToString() "
  • ";
    }
    showHtml(st);
    }
    catch { }
    }
    private void toTwo()
    {
    try
    {
    string st = String.Empty;
    string companyName= Request["nameparam"].ToString();
    DataTable dt2= DBUtility.DbHelperSQL.Query("select top(5) Title,Id from 公告表 where Id IN (select top 10 Id from 公告表 where TypeId='2' And Creater='" companyName "'order by CreatTime desc) order by CreatTime asc").Tables[0];
    //把公告做成超链接
    for (int i = 0; i < dt2.Rows.Count; i )
    {
    st = "
  • " dt2.Rows[i]["Title"].ToString() "
  • ";
    }
    showHtml(st);
    }
    catch { }
    }
    private void showHtml(string st){
    Response.ContentType = "text/html";//text/html,和application/json 都是输出格式
    Response.Write(st);
    Response.Flush();
    Response.Close();
    }
    }
    }

    Statement:
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn