Asp.net窄屏页面 手机端新闻列表
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SearchNotice.aspx.cs" Inherits="SignetPortal.Views.Mobile.SerchNotice" %> <%@ Import Namespace="SignetPortal.Share.UnClass" %>
<%@ Import Namespace="SignetPortal.Share.AllHelper" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title></title>
<meta name="viewport" content="width=device-width" />
<link href="../../Scripts/bootstrap-3.3.2-dist/css/bootstrap.min.css" rel="stylesheet"
type="text/css" />
<script src="../../Scripts/bootstrap-3.3.2-dist/js/jquery-1.11.2.js" type="text/javascript"></script>
<script src="../../Scripts/bootstrap-3.3.2-dist/js/bootstrap.js" type="text/javascript"></script>
<script src="http://int.dpool.sina.com.cn/iplookup/iplookup.php?format=js" type="text/ecmascript"></script>
<script type="text/javascript">
function show(obj) {
window.location.href = "Notice.aspx?" + obj;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<input id="CompanyId" name="CompanyId" type="hidden" value="" maxLength="" title="企业编码" />
<div class="list-group">
<%-- <a href="#" class="list-group-item active">
<asp:Label ID="labNoticeSection" runat="server"></asp:Label></a>--%>
<asp:Repeater ID="Rpdata" runat="server">
<ItemTemplate>
<a href="#" onclick="show('<%# AspNetPage.SetQueryString("NoticeId",Eval("NoticeId").ToString())%>')"
class="list-group-item">
<%# Eval("NoticeTitle").ToString().Length > ? Eval("NoticeTitle").ToString().Substring(, ) + "..." : Eval("NoticeTitle").ToString()%>
</a>
</ItemTemplate>
</asp:Repeater>
</div>
<nav>
<ul class="pager">
<li><asp:LinkButton ID="lbtnpritPage" runat="server" OnClick="lbtnpritPage_Click">上一页</asp:LinkButton></li>
<li><asp:LinkButton ID="lbtnNextPage" runat="server" OnClick="lbtnNextPage_Click">下一页</asp:LinkButton></li>
</ul>
</nav>
</form>
</body>
</html>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data; namespace SignetPortal.Views.Mobile
{
public partial class SerchNotice : System.Web.UI.Page
{
/// <summary>
/// 创建分页数据源的对象
/// </summary>
protected PagedDataSource psd = new PagedDataSource();
protected static int PageIndex = ; protected void Page_Load(object sender, EventArgs e)
{
}
/// <summary>
/// 通过 url 获取地域编码
/// </summary>
/// <returns></returns>
protected static string GetArea()
{
System.Web.UI.Page page = System.Web.HttpContext.Current.Handler as System.Web.UI.Page;
string area = "";
if (page != null)
{
string queryString = System.Web.HttpContext.Current.Request.QueryString["area"].ToString(); //string queryString = System.Web.HttpContext.Current.Request.Url.Query;
//queryString.Substring(queryString.Length - 4); area = queryString;
if (area != "" && area != "" && area != "" && area != "" && area != "" && area != "")
{
area = "";
} }
return area;
} protected void Page_PreRender(object sender, EventArgs e)
{
Session["CityId"] = GetArea();
if (Session["CityId"] == null)
{
Response.Redirect("Index.aspx", false);
return;
}
if (!Page.IsPostBack)
{
BindNotice(sender, e);
}
}
private void BindNotice(object sender, EventArgs e)
{
try
{
string noticeSection = Request.QueryString["NoticeSection"].ToString();
string cityId = "";
if (Session["CityId"] != null)
{
cityId = Session["CityId"].ToString();
}
Share.UnClass.PageExerciser pv = new Share.UnClass.PageExerciser();
DataTable dt = Logic.Bll.News.SearchNotice(pv, noticeSection, cityId);
if (dt != null)
{
psd.AllowPaging = true;
psd.PageSize = ;
//获取总页数
int pageCount = dt.Rows.Count % == ? dt.Rows.Count / : dt.Rows.Count / + ; if (sender is int && PageIndex > && pageCount > )
{
PageIndex--; }
else if (sender is string && (PageIndex + ) < pageCount)
{
PageIndex++;
} psd.CurrentPageIndex = PageIndex; psd.DataSource = dt.DefaultView;
Rpdata.DataSource = psd;
Rpdata.DataBind(); //Rpdata.DataSource = dt;
//Rpdata.DataBind();
}
}
catch (Exception ex)
{
}
} protected void lbtnpritPage_Click(object sender, EventArgs e)
{
sender = -;
} protected void lbtnNextPage_Click(object sender, EventArgs e)
{
sender = "Next";
this.BindNotice(sender, e);
}
}
}
Asp.net窄屏页面 手机端新闻列表的更多相关文章
- H5页面手机端禁止缩放的正确方式
H5页面禁止手机端缩放是个常见问题了 首先说meta方式 <meta content="width=device-width, initial-scale=1.0, maximum-s ...
- jquery手机端产品列表响应式宽高检测宽度赋值给高度让宽高相同
在手机端浏览商品列表,开发人员懂得设计图片做正好的尺寸,那样浏览很好,但有人天生泛懒图片都是随手上传不管大小合适不合适,要求还是响应式的.今天就用jquery检测宽度,并赋值给高度来实现错位问题 &l ...
- vue H5页面手机端 利用canvas 签名
签名首先用一个canvas标签,上面加三个代码,分别是点击,移动,离开.这里点击是开始画笔的地方,如果不加@touchstart 笔头会发生偏移,可以试试. @toucheend也是如此.尾巴也会出现 ...
- html2canvas 截屏 兼容手机端
<template> <div> <!--<input type="button" id="btnsavaImg" valu ...
- ASP.NET菜鸟之路之实现新闻列表增删改
背景 我是一个ASP.NET菜鸟,暂时开始学习ASP.NET,在此记录下我个人敲的代码,没有多少参考价值,请看到的盆友们为我点个赞支持我一下,多谢了. 网站介绍 根据视频的例子修改的方法,其中数据不经 ...
- chrome 手机端滑动列表的时候控制台会出现很多提示的解决办法
问题: Unable to preventDefault inside passive event listener 可以加入touch-action 属性,具体参照MDN, https://deve ...
- 【极品代码】一般人我不告诉他,手机端h5播放时不自动全屏代码
已测适用于ios,某些安卓手机微信下播放视频会出现播放器控件(这个实在是无力吐槽噢,因为之前还遇到过微信播放完视频后竟然无法退出全屏出现广告的情况,只有播放完后刷新页面并且要放到框架页里才能屏蔽微信视 ...
- fullpage 单屏高度超过屏幕高度,实现单屏内可以滚动并解决手机端单屏高度不正确的问题
最近接触了好几次jquery.fullpage.js这个插件,实现整屏的滑动,效果很炫,用fullpage来实现也很简单,但是也碰到了一些问题和大家分享一下 1.单屏高度超过屏幕高度,实现单屏的滑动 ...
- 手机端页面自适应解决方案—rem布局进阶版
手机端页面自适应解决方案—rem布局进阶版 https://www.jianshu.com/p/985d26b40199 注:本文转载之处:https://www.cnblogs.com/anni ...
随机推荐
- [codevs1027]姓名与ID
[codevs1027]姓名与ID 试题描述 有N个人,各自有一个姓名和ID(别名).每个人的姓名和ID都没有重复.这些人依次进入一间房间,然后可能会离开.过程中可以得到一些信息,告知在房间里的某个人 ...
- 如何学习caffe
知乎上的讨论:https://www.zhihu.com/question/27982282 从0开始山寨caffe系列:http://www.cnblogs.com/neopenx/archive/ ...
- TP框架自动加载优先级
$map = array('Think\Log'=>THINK_PATH.'Think\Log.php','Org\Util\Array'=>THINK_PATH.'Org\Util\Ar ...
- Java 数据库操作之Dao类
package Dao; import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Statement; imp ...
- 4.5---判断是否是二叉排序树BST(CC150)
public boolean checkBST(TreeNode root) { return isBST(root, Long.MIN_VALUE, Long.MAX_VALUE); } publi ...
- ubuntu14.04 163sources.list
deb http://mirrors.163.com/ubuntu/ trusty main restricted universe multiverse deb http://mirrors.163 ...
- Longest Increasing Path in a Matrix
Given an integer matrix, find the length of the longest increasing path. From each cell, you can eit ...
- [转载]Python 3.5 协程究竟是个啥
http://blog.rainy.im/2016/03/10/how-the-heck-does-async-await-work-in-python-3-5/ [译] Python 3.5 协程究 ...
- 【leetcode】Search in Rotated Sorted Array II
Search in Rotated Sorted Array II Follow up for "Search in Rotated Sorted Array":What if d ...
- 一些笔试题(C/C++)
1.there are two variables, don't use if.. else or ?: or switch or other judgement statements,find ou ...