开发者

ASP .NET Reques.Form DropDownlist strange behavior

I have an issue getting the selec开发者_高级运维ted value of a dropdownlist.

My view source looks like this:

<div class="editor-field">  
  <select class="list" id="DivisionesLists" name="DivisionesLists">
    <option value=""> -- Seleccione -- </option>
    <option selected="selected" value="1">COORPORATIVO</option>
    <option value="2">MANUFACTURA</option>
  </select>
</div>

And my controller:

string s = Request.Form["DivisionesLists"];

The problem is that Request.Form["DivisionesLists"] returns "1,1" instead of just "1" (which is the actual selected value of the dropdownlist).

What may be happening?

Thank you!!!


It might also be posting some additional data, what happens if you select the first one, what does it post back? Does it post anything back with a comma?

It could be a duplicate control... though like Html.CheckBox action method: it renders the checkbox control and a hidden field that represents the value when the checkbox isn't there; accessing the value when its checked is true,false.

HTH.


If the select isn't a multiple select I think you have another control (input or select) that have the same name attribute on the page.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜