表单集合项目为null

时间:2022-12-05 22:57:54

I am trying to use form collection and this is what i am using to submit the form.

我正在尝试使用表单集合,这是我用来提交表单。

 <%=Html.ActionLink("Update", "Calendar", ViewData["sub"], new { onclick =  "this.form.submit();" })%>

Just for the heck of it i tried replacing it with a dropdownlist that retains its value and all of a sudden i get all my form collection.

只是为了它,我尝试用一​​个保留其价值的下拉列表替换它,突然间我得到了我的所有表单集合。

 <%=Html.DropDownList("dllMonth", new SelectList(new List<string>() { "January", 
    "Feburary", "March", "April", "June", "July", "August", "September", "October", "November", "December"}, ViewData["Month"]), new { onchange = "this.form.submit();" })%>

Can someone please explain whats going on?

有人可以解释一下发生什么事吗?

1 个解决方案

#1


I changed my action link to the following and now all is working fine:

我将我的操作链接更改为以下内容,现在一切正常:

<a name="update" href="Calendar" onclick="this.form.submit();" type="submit">Update</a> 

#1


I changed my action link to the following and now all is working fine:

我将我的操作链接更改为以下内容,现在一切正常:

<a name="update" href="Calendar" onclick="this.form.submit();" type="submit">Update</a>