【ASP.NET技巧:做个DataList可分页的数据源】教程文章相关的互联网学习教程文章

(asp.net c#)DropDownList绑定后显示对应的项的两种方法【图】

方法一: 实现代码 代码如下:DropDownList1.DataSource = listSort; DropDownList1.DataTextField = "LogSortName"; DropDownList1.DataValueField = "LogSortID"; DropDownList1.DataBind(); DropDownList1.SelectedIndex = ddl.Items.IndexOf(DropDownList1.Items.FindByValue("i")); //i要自己去获取你要显示的项的id。 方法二:我贴上部分代码 获取数据后 根据该value去配对你想要的项。 不过图中的for改成 do…while 应该会...

客户端用JavaScript填充DropDownList控件 服务器端读不到值

填充没有任何问题,但是在服务器端却取不出来下拉表中的内容。页面代码如下。 代码如下:<form id="form1" runat="server"> <div> <h3>看看用js填充的dropdownlist控件在服务器端能读出来吗?</h3> 三个级联下拉列表框: <asp:DropDownList runat="server" id="bigTypeList" Width="150"> </asp:DropDownList> <asp:DropDownList runat="server" id="typeList" Width="150"> </asp:DropDownList> <asp:DropDownList runat="server"...

asp.net中Datalist使用数字分页的实现方法

代码如下:<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Test(Datalist数字分页).aspx.cs" Inherits="Test_Datalist数字分页_" %> <!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 runat="server"> <title>无标题页</title> <link href="CSS/CSS.css" rel="stylesheet" type="text/c...

asp.net省市三级联动的DropDownList+Ajax的三种框架(aspnet/Jquery/ExtJs)示例【图】

本文主要列举了省市三级联动的DropDownList+Ajax的三种框架(aspnet/Jquery/ExtJs)示例。前段时间需要作一个的Web前端应用,需要用多个框架,一个典型的应用场景是省市三级联动,基于此应用,特将三种主要的ajax框架略作整理,方便有需要的朋友查阅。 在示例之前,我们先设置一个演示数据源,新建一个项目,项目结构如图: 主要文件如下:AreaModel.cs: 代码如下:using System; using System.Collections.Generic; namespace Dow...

javascript实现listbox左右移动实现代码【图】

1。 html部分: 代码如下:<table cellSpacing="0" borderColorDark="#ffffff" cellPadding="3" width="460" align="left" borderColorLight="#000000" border="1"> <tr bgColor="#cccccc"> <td align="center" width="180"><b>所有地区</b> <asp:HiddenField ID="HidDistrictId" runat="server" /> </td> <td align="center" width="60"> </td> <td align="center" width="180"><b>已选地区</b></td> </tr> <tr > <td bgcolor="#c...

ASP.NET DropDownList控件的使用方法

1. 数据绑定 代码如下:this.DropDownList1.DataSource = CategoryManager.getCategories(); DropDownList1.DataValueField = "id";//用来设置下拉列表选中的 Value 值 DropDownList1.DataTextField = "name";//为下拉列表选项显示的值 DropDownList1.DataBind(); 2.读取数据 代码如下:int categoryId = int.Parse(this.DropDownList1.SelectedItem.Value);//获取下拉列表中选中的值

asp.net 获取Datalist中Checkbox的值的小结

前台的示例代码如下,用的是datalist控件,要显示的是Student表中的StudentID和姓名 代码如下:<asp:DataList ID="dlTable" runat="server" > <ItemTemplate> <td align="center"> <asp:Label ID="lblID" runat="server" Text=<%#Eval("StudentID") %> Visible="false"></asp:Label> <asp:CheckBox ID="Chkbox" runat="server" /> </td> <td> <%#Eval("studentname") %> </td> <td> <%#Eval("studentid") %> </td> </ItemTemplate>...

asp.net ListView交替背景颜色实现代码

只一行代码: 代码如下:<tr style="<%# (Container.DisplayIndex%2==0)?"background-color:white;":"background-color:#EEEEEE;" %>"> 另外还有直接用js处理整个页面中所有tr的交替色: 代码如下:<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>全选并改变TR颜色</title> <script language="JavaScript" type="text/javascript" for="checkbox" event="onclick"><!-- tr_bgcolor(...

asp.net Javascript获取CheckBoxList的value

以后我会陆续的写出这段时间中学习到的东西,与大家一起分享。这篇文章也算是工作中的一个笔记吧,希望给遇到同样问题的朋友,一点小小的帮助。 在 开发工作中,因为要做用到CheckBoxList在客户端用js操作,无论js怎样调试,就是无法获取value的值,很是郁闷,后来Google了下,去了趟CodeProject,算是幸运的。我们在网页上放置一下代码: 代码如下:<asp:CheckBoxList runat="server" ID="chkDemo" RepeatDirection="Horizontal" ...

asp.net使用for循环实现Datalist的分列显示功能

服务器控件虽然用起来方便,但是也牺牲了性能,有些时候用起来显得大而无当。希望先进朋友多多指教。 代码如下:/// <summary> /// 工程业绩--用for循环代替了DataList多列显示,得到2行四列的表格,需要内存表的8行数据 /// </summary> private void GcyjShow() { StringBuilder sb = new StringBuilder(); ProductBLL pb = new ProductBLL(); DataTable dt = pb.GetProductByMoreConditions("工程业绩", "工程业绩", "启用"); int...

asp.net 通过aspnetpager为DataList分页

前台代码: 代码 代码如下:<div id="newslistdiv"> <asp:DataList ID="NewsList" runat="server" Width="820px"> <HeaderTemplate> <div> <img src="../loginimages/newslisthead.gif" alt="" /></div> </HeaderTemplate> <ItemTemplate> <dl> <dd> <a href="#" class="rlk" onclick=window.location.href="DetailNews.aspx?ID=<%#Eval("NewsID") %>"><%#Eval("NewsTitle") %></a> <%#Eval("NewsTime", "{0:yyyy-MM-dd}")%><br...

asp.net DropDownList 三级联动下拉菜单实现代码

代码如下:if (!IsPostBack) { //一级分类列表 this.DropDownList1.DataSource = dsbb.SelectSubjct1(); this.DropDownList1.DataTextField = "cName"; this.DropDownList1.DataValueField = "Ccode"; this.DropDownList1.DataBind(); this.DropDownList1.Items.Insert(0,new ListItem("请选择一级分类","0")); this.DropDownList8.Items.Insert(0, new ListItem("请选择二级分类", "0")); this.DropDownList9.Items.Insert(0,new L...

asp.net DataList与Repeater用法区别

性能方面 Repeater比DataList要好一些,如果不是很大数据量的话,这点差别是体现不来的。 易用性方面 Repeater与DataList后台的数据绑定都很简单,DataSource=... DataBind()就OK了 但是DataList在对布局的操作上更加的方便一些,如它提供了SelectItemTemplate,EidtItemTemplate等,但是Repeater却没有,所以对于有选中颜色或者背景图片改变,最好选用DataList.如果用Repeater就需javascript去控制了。 Html解析 DataList自身会被解...

asp.net IList查询数据后格式化数据再绑定控件【图】

一、先讲最基本的 DataSet绑定操作,GridView为例。 当操作查询得一个 DataSet ds 后,可以进行一些数据的格式化,如: 代码如下:foreach (DataRow dr in ds.Tables[0].Rows) { if (dr["Depth"].ToString() != "1") { dr["ColumnName"] = StringHelper.StringOfChar(Convert.ToInt32(dr["Depth"]) - 1, " ") + "├ " + dr["ColumnName"]; } } GridView1.DataSource = ds; GridView1.DataBind(); 代码如下:public static class ...

asp.net 枚举文件里面的数字绑定到DropDownList里面去

代码如下:public class AppEnum { public enum PointLogType : int { /// <summary> /// Email确认 /// </summary> [Description("Email确认")] Recruit = 1, //新客户激活+ /// <summary> /// 老客户回馈 /// </summary> [Description("老客户回馈")] Veteran = 2, //老客户购物历史回复 /// <summary> /// 生成订单 /// </summary> [Description("生成订单")] CreateOrder = 3, //下订单- /// <summary> /// 作废订单 /// </summ...