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


相关文档:

Tip/Trick: Url Rewriting with ASP.NET

 
People often ask me for guidance on how they can dynamically "re-write" URLs and/or have the ability to publish cleaner URL end-points within their ASP.NET web applications.  This blog post summarizes a few approaches you can take to cleanly map or rewrite URLs with ASP.NET, and have th ......

ASP.NET的ACCESS数据库操作类

//private string datapatch = ConfigurationSettings.AppSettings["acessconn"];//数据库地址 
private string datapatch = "db/global.asa";//数据库地址 
/// 
/// 取得dataset 
// 
/// 查询语句 
/// 
public DataSet GetDataSet(string Commandtext) 
{&nbs ......

在ASP.NET中下载文件

//TransmitFile实现下载
    protected void Button1_Click(object sender, EventArgs
e)
    {
        /*
       
微软为Response对象提供了一个新的方法TransmitFile来解决使用Response.BinaryWrite
......

文件上传代码(asp.net)

Boolean fileOK = false;
        String path = "D:\\";
        //string path = "1.gif";
      
            String fileExtension =
 &nbs ......

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

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