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

ASP.NET MVC post提交表单 后台值为空

昨天遇到了一个小问题,提交表单的时候,后台的action中验证的表单里的控件值居然是空值,调来调去不得其法.
我在前台的表单里控件用的是标准html控件
页面上使用下面语句发送form
<%using (Html.BeginForm("AddNewPicGroups", "MetaData")){ %>
后台使用如下语句接收时却接收不到数据
public ActionResult AddNewPicGroups(FormCollection formValues)
{
 string new_picGroupNameTextBox = Request.Form["new_picGroupNameTextBox"];
 string new_picGroupDesTextBox = Request.Form["new_picGroupDesTextBox"];
 return View();
}
页面上使用input就无效
<input id="new_picGroupDesTextBox" type="text" style="width:98%;" />
但是使用Html.TextBox时就没有问题,后台就可以接收到表单中的数据.
<%= Html.TextBox("username") %>
后来直接查看生成的网页代码才发现Html.TextBox会生成name值,该值和id是一样的,而我写的<input>里面没有name值,添加上name值之后就可以了。


相关文档:

ASP.NET面试题:ListView扩展

公司要求开发一个继承System.Windows.Forms.ListView类的组件,要求达到以下的特殊功能:点击ListView各列列头时,能按照点击列的每行值进行重排视图中的所有行 (排序的方式如DataGrid相似)。根据您的知识,请简要谈一下您的思路 ?
直接放上代码:
using System;
using System.Collections.Generic;
using System.Comp ......

silverlight 融合ASP.NET MVC 例子


using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Sha ......

设置自定义ASP.NET服务器控件TagPrefix的几种方法


方法一、在Web.config中配置,具体做法为:在Web.config文件的System.web节中添加如下代码
1<pages>
2 <controls>
3 <add assembly="ServerControl" namespace="ServerControl" tagPrefix="sc"/>
4 </controls>
5</pages>
说明:assembly表示控件所在的程序集名称,nam ......

ASP.NET程序员应用程序域须知

  本文将讨论.NET的应用程序域,并且它们是如何对ASP.NET的执行和调度产生影响的。  
   
    当在Windows中启动Notepad程序时,众所周知程序会执行一个包含在容器内的进程。可以启动多个Notepad的实例,并且每个实例都会在一个专注的进行程运行。使用任务管理器,可以看到在系统中当前运行 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号