Click here to Skip to main content
16,004,458 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
HTML
@model TestApplication.Models.GetQuestions

@{
    ViewBag.Title = "Index";
    Layout = null;
}
@section scripts
{
    <script type="text/javascript" src="~/Scripts/jquery-1.8.3.js"></script>
    <script type="text/javascript" src="~/Scripts/jquery.unobtrusive-ajax.js"></script>
}

<h2>Index</h2>
@Ajax.BeginForm("ViewQuestions","ViewQuest",new AjaxOptions { HttpMethod = "POST", UpdateTargetId = "div1", 
     InsertionMode = InsertionMode.Replace, LoadingElementId = "waitimage" })

<input type="submit" value="Next" name="Command"/>
@{Html.EndForm();}
<br />
<img id="waitimage" src="~/Content/images/Loading_icon.gif" style="display:none" />
<br />
<div id="div1">
    

</div>


and here my partial view code
HTML
@model TestApplication.Models.GetQuestions

@{
    ViewBag.Title = "ViewQuestions";
}
@{
    Layout = null;
    
}
<h2>ViewQuestions</h2>
@using (Html.BeginForm("Forward","ViewQuest"))
{
<fieldset>
    <legend>GetQuestions</legend>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.QuestID)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.QuestID)
        @Html.HiddenFor(model=>model.QuestID)
    </div>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.QuestImage)
    </div>
    <div class="display-field">
        <img src=" @Html.DisplayFor(model => model.QuestImage)" />
        
    </div>

    <div class="display-label">
         @Html.DisplayNameFor(model => model.Question)
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Question)
    </div>
    <div>
        <table>
            <tr>
                <th>Choose one of them</th>
            </tr>
            @foreach (var options in Model.Options)
            {
                <tr>
                    <td>
                        @Html.RadioButtonFor(m=>m.Options,options.Option1)@options.Option1
                    </td>
                </tr>
            }
        </table>
    </div>
    <

</fieldset>
}


What I have tried:

I just try to get the selected value of radiobutton list from partial view by the submit button of the Main View.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900