ASP.NET单值和列表控件的数据绑定
一、(单值绑定)在页面的后台代码中定义公有变量,如下:
public string gongYou = "声明的公有成员";
①然后在页面的源中调用,如下:
<asp:Label ID="lblMgs" runat="server" Text="<%#gongYou >"></asp:Label>
②当然最后要记得绑定数据:
protected void Page_Load(object sender, EventArgs e)
{
Page.DataBind();
}
注:<%# %>作用是在前台显示代码中嵌入访问后台数据的表达式来完成数据绑定。
二、列表控件的数据绑定
介绍一下DropDownList,CheckBox,BulletedList;
一般来说,实现IEnumerable,IListSource,IDataSource和IHierarchicalDataSource的类都可以作为数据源。
例:页面代码:
<div>
<asp:DropDownList ID="ddlSelect" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ddlSelect_SelectedIndexChanged"
Width="158px">
</asp:DropDownList>
<asp:TextBox ID="txtDDL" runat="server"></asp:TextBox><br />
<br />
<asp:CheckBoxList ID="cblNameANDSex" runat="server">
</asp:CheckBoxList>
<asp:Button ID="btnShowNameANDSex" runat="server" OnClick="btnShowNameANDSex_Click"
Text="OK" />
<asp:TextBox ID="txtNameAndSex" runat="server"></asp:TextBox>
<br />
<br />
<asp:BulletedList ID="blUrl" runat="server" DisplayMode="HyperLink" Target="_blank">
</asp:BulletedList>
</div>
后台代码:
//定义一帮助类,为初始化ArrayList时,做参数用;
public class KeyValueClass
{
private string webSiteName;
public string WebSiteName
{
get { return webSiteName; }
set { webSiteName = value; }
}
private string webSiteUrl;
public string WebSiteUrl
{
相关文档:
ASP.NET
使用无Cookie的表单认证票据
默认情况下,forms authentication system将决定是将票据存储在cookies
collection里还是插入用户访问页面的URL里。所有主流的桌面浏览器,比如Internet
Explorer,Firefox,Opera,或Safari都支持cookies,但并非所有的移动设备都支持。
forms authentication system使用何种co ......
解决方法:
1.看看你的Terminal Services服务启动没有,如果没有启动就可以解决问题。
2确认 Machine Debug Manager 服务已启动
3、打开项目属性,在“Debug”(调试)一项里,把“Enable the Visual Studio hosting process”(启用Visual Studio 宿主进程)前的钩去掉。
4. ......
JSP同样是实现动态网页的一个利器。由于他的脚本语言是JAVA,所以继承了JAVA诸多优点。那么与ASP相比,应该可以说ASP和JSP基本不是一个档次上的。那么ASP.NET和JAVA却是可以抗衡的。
JSP和ASP相比较: 运行速度、运行开销、运行平台、扩展性、安全性、函数支持、厂商支持、对XML的支持等等,ASP都不是JSP的对手。COM ......
项目和网站的区别
项目编译成dll,网站通过“发布网站”来部署
部署目的地:/bin目录下
7个顶级目录及其编译情况
三种部署方式及其程序集生成情况 (程序集影子拷贝)
定制程序集生成:
<compilation>
<codeSubDirectories>
<add directoryName="vb_components"/ ......