使用.net开发wap的都会为这个工具的强大所震撼,忘掉在php,asp,jsp中的write wml语法吧.但是,美中不足的是其中的类web中的datagrid控件objectlist没有他所宣称的那么方便,至少不符合中国人的习惯.那么,来吧,让我来告诉一种更简单的写list控件的方法.
(1): 写一个类继承MobileControl
(2):在CreateChildControls方法中,动态的增加你需要的控件,通常是link与label.
demo如下:
public class ChananelUserList : MobileControl
{
/// </summary
///
/// </summary>
/// </summary
///
/// </summary>
[Bindable(true),Category("Data")]
public int UserID
{
set
{
ViewState["UserID"]=value;
}
get
{
if(ViewState["UserID"]!=null)
return (int)ViewState["UserID"];
return 0;
}
}
[Bindable(true),Category("Data")]
public string ani
{
set
{
ViewState["ani"]=value;
}
get
{
if(ViewState["ani"]!=null)
return (string)ViewState["ani"];
return "0";
}
}
[Bindable(true),Category("Data")]
public string ChannalID
{
set
{
ViewState["ChannalID"]=value;
}
get
{
if(ViewState["ChannalID"]!=null)
return (string)ViewState["ChannalID"];
return "0";
}
}
/// <summary>
///
/// </summary>
/// <param name="e"></param>
protected override void OnInit(EventArgs e)
{
base.OnInit (e);
}
/// <summary>
///
/// </summary>
protected override void CreateChildControls()
{
System.Data.DataSet ds=Common2.GetChannelUser(UserID,ChannalID,ani);
if(ds!=null)
{
System.Data.DataTable dt=ds.Tables[0];
if(dt.Rows.Count>0)
{
for(int i=0;i<dt.Rows.Count;i++)
{
System.Web.UI.MobileControls.Link ChaMemTelLink=new System.Web.UI.MobileControls.Link();//电话
ChaMemTelLink.Text=Convert.ToString(dt.Rows[i][4]);
ChaMemTelLink.BreakAfter=false;
Controls.Add(ChaMemTelLink);
System.Web.UI.MobileControls.Label blankLabel1=new System.Web.UI.MobileControls.Label();//空
blankLabel1.Text=" ";
blankLabel1.BreakAfter=false;
Controls.Add(blankLabel1);
System.Web.UI.MobileControls.Link DeleteLink=new System.Web.UI.MobileControls.Link();//删除
DeleteLink.Text="删除";
DeleteLink.NavigateUrl="frmChannelMemDelete.aspx?"+"ani="+ani+
"&UserID="+UserID.ToString()+"&ChannalID="+ChannalID+"&ID="+Convert.ToInt32(dt.Rows[i][0]);
Controls.Add(DeleteLink);
}
}
else
{
System.Web.UI.MobileControls.Label Output=new System.Web.UI.MobileControls.Label();
Output.Text="该频道还没有人,请先添加.";
Controls.Add(Output);
}
}
}
}
分享到:
相关推荐
Now in its 8th edition, you’ll find all the very latest C# 7.1 and .NET 4.7 features here, along with four brand new chapters on Microsoft’s lightweight, cross-platform framework, .NET Core, up to ...
Create powerful cross-platform applications using C# 6, .NET Core 1.0, ASP.NET Core 1.0, and Visual Studio 2015 About This Book Build modern, cross-platform applications with .NET Core 1.0 Get up-...
C# 7 and .NET Core: Modern Cross-Platform Development - Second Edition by Mark J. Price English | 24 Mar. 2017 | ASIN: B01N8UG78Q | 594 Pages | AZW3 | 23.26 MB Modern Cross-Platform Development ...
《#企业应用开发艺术CSLA.NET框架开发实战》(Expert C#2008 Business Objects)配套源码及例程csla-4.5.700。 CSLA .NET is a software development framework that helps you build a reusable, maintainable ...
Concurrency in .NET teaches you how to build concurrent and scalable programs in .NET using the functional paradigm. This intermediate-level guide is aimed at developers, architects, and passionate ...
wap(ASP.NET的ObjectList控件)
This new 7th edition of Pro C# 6.0 and the .NET 4.6 Platform has been completely revised and rewritten to reflect the latest changes to the C# language specification and new advances in the .NET ...
supermap object.net入门
ASP.NET: State Server Gems 完整的动态加载/卸载程序集的解决方案 从NUnit中理解.NET自定义属性的应用(转载) 如何在.NET中实现脚本引擎 (CodeDom篇) .NET的插件机制的简单实现 我对J2EE和.NET的一点理解 难分难舍...
你可在Visual Studio中查看第三方代码,就像浏览自己的代码一样。 功能特征: 全面支持.NET 2.0、.NET 3.0、.NET 3.5和.NET 4.0 Windows Shell集成–运行Reflector.exe /寄存器,注册文件扩展名 NET 2.0、.NET 3.0、...
CSLA.NET是一个在分布式环境下只通过修改配置文件就可以实现N层部署的框架. 它致力于构建丰富,强大而灵活的业务层,包含了验证,权限,数据门户等标准化的解决方案,使你的业务对象更加标准和灵活.它提出了移动对象...
用法 <webdiyer:aspnetpager id=\"AspNetPager1\... protected void AspNetPager1_PageChanged(object src, EventArgs e) { this.bind(...,..., AspNetPager1.PageSize, AspNetPager1.CurrentPageIndex); }
[Apress] CSLA .NET 框架企业应用开发艺术 (2008 版本) (英文版) [Apress] Expert C# 2008 Business Objects (E-Book) ☆ 图书概要:☆ In Rockford Lhotka’s Expert C# 2008 Business Objects, you’ll learn ...
Spring.NET是一个应用程序框架,其目的是协助开发人员创建企业级的.NET应用程序。它提供了很多方面的功能,比如依赖注入、面向方面编程(AOP)、数据访问抽象及ASP.NET扩展等等。Spring.NET以Java版的Spring框架为...
详细介绍了基于C#.net的FME OBJECTS二次开发步骤。。
通过vc.net开发gis (MapObject)
Applied ADO.NET: Building Data-Driven Solutions 第二部分 Table of Contents Applied ADO.NET—Building Data-Driven Solutions Introduction Chapter 1 - ADO.NET Basics Chapter 2 - Data Components ...
Migrating to .NET: A Pragmatic Path to Visual Basic .NET, Visual C++ .NET, and ASP.NET Find out how to migrate your legacy software to the powerful Microsoft .NET framework Provides for a complete,...
Sample_02_02/ObjectPage.aspx 创建页面中的对象 Sample_02_03/Default.aspx 页面的生命周期 第3章(/ch03/) Sample_03_01/ClientInfo.aspx 获取客户端信息 Sample_03_01/Dir.aspx 目的 ...
vb.net 开发中使用excel 插件学习方法及代码 做excel插件开发,可能需要为excel添加自定义的工具栏。这个也是非常的简单的。 Public Class ConnectClass Connect Implements Extensibility.IDTExtensibility...