views:

19

answers:

1
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?

A: 

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"]) })%>
Malcolm Frexner