开发者

Can't show views every time when select value on drop down list

Select group <%=Html.DropDownList("GroupsDropDownLst",
    (IEnumerable<SelectListItem>)ViewData["GroupsDropDownLst"])%>

<fieldset>
    <legend>Devices And Accessories</legend>

    <p>Devices:</p>
    <%= Html.Action("ReadXMLDevices", "ImportXML", 
        new { groupID = Html.Encode(ViewData["GroupsDropDownLst"]) })%>

    <p>Accessories:</p>
    <%= Html.Action("ReadXMLAccessories", "ImportXML", 
        new { groupID = Html.Encode(开发者_高级运维ViewData["GroupsDropDownLst"]) })%>

</fieldset>

I need to show actions ReadXMLDevices and ReadXMLAccessories every time when select some value on drop down list. Any solutions?


Try this if you want to submit the form when the user selects an item in the dropdownlist.

  <%=Html.DropDownList("GroupsDropDownLst", (IEnumerable<SelectListItem>)ViewData["GroupsDropDownLst"], new { onchange="this.form.submit();" })%>

I would also include a submit button, if the user has no javascript enabled.

GroupsDropDownLst as the first Parameter for the dropdownlist doesn't look right. The variable that holds the selected group (ie GroupID) should be here. It is also used in your action links.

<%= Html.ActionLink("ReadXMLAccessories", "ImportXML", 
        new { groupID = Html.Encode(ViewData["GroupID"]) })%>
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜