易截截图软件、单文件、免安装、纯绿色、仅160KB

ASP.NET 3.5 MVC 架构与实战笔记6 HtmlHelper控件解析

FormExtensions类
FormExtensions类是一个静态类,定义了3种类型的扩展方法:BeginForm、BeginRouteForm、EndForm;在实际开发中,也可以使用using语句,而不需要写EndForm扩展方法。
InputExtensions类
InputExtensions类定义了5种类型的扩展方法:CheckBox,Hidden,Password,RadioButton,TextBox.

<fieldset>
<legend>CheckBoxlegend>

<label for="checkbox1">XieTilabel>


<label for="checkbox2">HeiTilabel>

<br/><br/>
<input type="submit" value="submit" />
</fieldset>

看看运行后的网页源代码吧:
<!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><title>
TestPage
title>head>
<body>
<div>
<form action="/Study/Index" method="post">System.Web.Mvc.Html.MvcForm
<fieldset>
<legend>¨¦¨¨??CheckBoxlegend>
<input checked="checked" id="checkBox1" name="MyCheckBox1" type="checkbox" value="true" /><input name="MyCheckBox1" type="hidden" value="false" />
<label for="checkbox1">label>

<input id="mycheckBox2" name="MyCheckBox2" type="checkbox" value="true" /><input name="MyCheckBox2" type="hidden" value="false" />
<label for="checkbox2">label>

<br/><br/>
<input type="submit" value="submit" />
fieldset>
form>
div>
body>
html>
对于每一个CheckBox控件,MVC都另外生成了一个隐藏的对应控件
<input name="MyCheckBox1" type="hidden" value="false" /> <input name="MyCheckBox2" type="hidden" value="false" /> ;
所以在控制器中检测复选框的状态,可以使用如下代码:
public ActionResult CheckBox(FormCollection formCollection)
{
b


相关文档:

ASP.NET连接各类数据库集锦

1.C#连接连接Access
程序代码:
------------------------------------------------------------------------------- using System.Data;
using System.Data.OleDb;
..
string strConnection="Provider=Microsoft.Jet.OleDb.4.0;";
strConnection+=@"Data Source=C:BegASPNETNorthwind.mdb";
Ol ......

一个简单的ASP.NET +ACCESS 登录

首页:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 ......

ASP.NET中防止页面多次提交的代码实现

此处提供的代码用来实现当asp.net页面中的某个Button被点击后disable掉该页面中所有的Button,从而防止提交延时导致的多次提交。基于之前的onceclickbutton脚本.
//ASP.NET中防止页面多次提交的代码:javascript< script language="javascript"> < !-- function disableOtherSubmit() {
var obj = event.srcElem ......

asp.net 中日期和时间的格式化

这也许是一个小问题  但是有很多学问  不能眼高手低 我把大部分情况列出来 给大家一个提醒 
float str = 987654.32F;
//Response.Write(string.Format("{0:c}", str));
//this.Label1.Text = string.Format("{0:D}", str);
//this.Label1.Text = string.Format("{0:C}", str); ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号