易截截图软件、单文件、免安装、纯绿色、仅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 FileUpload应用实例

Default.aspx:
<%@ 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" ......

ASP.NET常用语句1

1.//弹出对话框.点击转向指定页面
Response.Write(&quot; <script>window.alert('该会员没有提交申请,请重新提交!')
</script>&quot;);
Response.Write(&quot; <script>window.location
='http://www.51aspx.com/bizpulic/upmeb.aspx' </script>&quot;);
2.//弹出对话框
Re ......

ASP.NET取网页数据《数据采集》


using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.IO;
using Sy ......

asp.net跳转页面的三种方法比较

asp.net跳转页面的三种方法比较
  今天老师讲了三种跳转页面的方法,现在总结如下:
  1. response.redirect  这个跳转页面的方法跳转的速度不快,因为它要走2个来回(2次postback),但他可以跳  转到任何页面,没有站点页面限制(即可以由雅虎跳到新浪),同时不能跳过登录保护。但速度慢是其最大缺陷!r ......

Building a Web 2.0 Portal with asp.net ajax 第二章

由于其致力于在一个单独页面上面提供功能,Ajax web 门户都是 Ajax 技术的杰作。在页面上提供众多的功能,同时又有服务器端和客户端良好的性能,对于架构是一个非常大的挑战。一些挑战只有在整合众多特性的 web 应用程序或者聚合其他网站内用的程序上面才有的。
本章解释了 Dropthings 的架构,你也可以在你的应用程序使用 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号