0

I have reviewed many solutions most of them are of jQuery .. I dont know how to check modal is open or not ... Actually I want to render the list after modal is open is there any way to do this in razor ....

<div class="modal fade popup-modal" id="myModalMembers" role="dialog" style="margin-top: 50px;height: 267px;">
    <div class=" modal-dialog modal-popup" style="height: 100%;">

        <!-- Modal content-->
        <div class="modal-content content-popup" style="height: 100%;">
            <div class="modal-header" style=" margin-top: -30px;border: none;">
                <button type="button" class="close" data-dismiss="modal">&times;</button>
                <h4 class="modal-title">Choose a Member</h4>
                <p>_________________________________________________________________________________________________________</p>
            </div>
            <br />
            @if ( $('#myModal').hasClass('in')) { // this is where i want to add conditon but i cant add like this there must a proper way to do so
                @Html.DropDownListFor(m => m.MemberModel.SelectedMember, Model.MemberModel.Members, "-- Select Member --", new { @class = "form-control selector" })
            }
            <div class="modal-footer">
                <input type="submit" value="Submit" name="memberSubmit" style="width: 100px;height: 30px;background-color: #254f91;" />
            </div>
        </div>
    </div>
</div>
Zain Abbas
  • 111
  • 3
  • 15
  • There are no [modals in Razor](http://stackoverflow.com/questions/13840429/what-is-the-difference-between-client-side-and-server-side-programming) – Mat J Jan 23 '17 at 12:45
  • Your question is lacking any detail. You need to show us the code that you tried, without that we cannot help. Please see https://stackoverflow.com/help/how-to-ask – Peter B Jan 23 '17 at 12:45
  • @PeterB I have updated my question – Zain Abbas Jan 23 '17 at 12:50
  • 2
    Razor code runs *on the server*, and the resulting HTML(+JS/CSS) output is sent to the browser. Razor can and will not do anything until a subsequent HTTP request is sent from the browser to the server. Javascript and jQuery code runs *in the browser*, and whatever happens in the browser stays in the browser until you make it do an HTTP request. – Peter B Jan 23 '17 at 12:54
  • Javascript runs in browser and .NET runs on server. – charlietfl Jan 23 '17 at 12:54
  • Yea i know that ... – Zain Abbas Jan 23 '17 at 12:59
  • You guys suggest to add script tag in my file – Zain Abbas Jan 23 '17 at 13:02
  • why do you need to render it after the modal is opened? Just render it when the page loads like normal, it will be hidden anyway until the modal opens. The only reason to load it later is if the content rendered into the modal depends on some action the user has done in the page. From the example it does not seem to be the case. – ADyson Jan 23 '17 at 13:40

0 Answers0