You must Sign In to post a response.
  • Category: ASP.Net MVC

    Mvc 5 Model popup with the list of employees in grid with check box in mvc 5

    Hi,

    I have to show the model popup with the list of employees in grid with check box in mvc 5. The selected employee ids should come back to main view.

    Any one suggest the good link or post me sample code to implement. It should be the MVC 5

    Regards,
    Kotireddy.
  • #766278
    Hi

    you can go through below link for Gridview in MVC5


    "binaryintellect.net/articles/59b91531-3fb2-4504-84a4-9f52e2d65c20.aspx"
    "codeproject.com/Articles/843788/WebGrid-in-ASP-NET-MVC-important-tips"


    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.

  • #766298
    Hi,

    If you want to get the selected records from modal popup and use that in your main view then my suggestion is go through AJAX modal popup extender control and show your modal dialog and design gridview inside that dialog and based on row selection you need to get the selected Id of that particular row,

    Refer below sample this might be helpful to you.

    <asp:Button ID="btnShowPopup" Text="Show Popup" runat="server" Style="display: none" />
    <cc1:ModalPopupExtender ID="mpe" runat="server" TargetControlID="btnShowPopup"
    PopupControlID="pnlPopup" BackgroundCssClass="modalBackground">
    </cc1:ModalPopupExtender>
    <asp:Panel ID="pnlPopup" runat="server" BackColor="White" Height="100px"
    Width="400px" Style="display: none">
    <table>
    <tr>
    <td>
    <asp:GridView Id="gv" runat="server" autogeneratecolumns="False"
    autogenerateselectbutton="True"
    selectedindex="1"
    onselectedindexchanged="gv_SelectedIndexChanged">
    <Columns>
    </Columns>
    </asp:GridView>
    </td>
    </tr>
    <tr>
    <td>
    <asp:HiddenField Id="hdnId" runat="server"/>
    <asp:Button Id="btnGet" runat="server" Text="Get Record" OnClick="btnGet_OnClick"/>
    </td>
    </tr>
    </table>
    </asp:Panel>


    and onSelectedIndexChanged event assign the index value to hidden field and while click on GetRecord button pass the hiddenfield value to main view.


    Protected void gv_SelectedIndexChanged(Object sender, EventArgs e)
    {
    GridViewRow row = gv.SelectedRow;
    hdnId.Value= row.Cells[2].Text ;
    }
    Protected void btnGet_OnClick(Object sender, EventArgs e)
    {
    //pass hidden field value to main view
    }


    Hope this will helpful to you....

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #766300
    Hi
    naveensanagasetti

    Listen the Question Carefully one and two time.

    He asked Mvc 5 Model popup only not web application.

    Check and post corresponding solution then proper reply.

    Name : Dotnet Developer-2015
    Email Id : kumaraspcode2009@gmail.com

    'Not by might nor by power, but by my Spirit,' says the LORD Almighty.


  • Sign In to post your comments