Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load PArtial view #201

Open
arajpant opened this issue Apr 3, 2020 · 0 comments
Open

Load PArtial view #201

arajpant opened this issue Apr 3, 2020 · 0 comments

Comments

@arajpant
Copy link

arajpant commented Apr 3, 2020

I have following code

MVCGridDefinitionTable.Add("LUServicePersonnelMOC", new MVCGridBuilder()
.WithAuthorizationType(AuthorizationType.AllowAnonymous)
.WithSorting(sorting: true, defaultSortColumn: "MOC_Service_Type", defaultSortDirection: SortDirection.Asc)
.WithPaging(paging: true, itemsPerPage: 10, allowChangePageSize: true, maxItemsPerPage: 100)
.WithAdditionalQueryOptionNames("search")
.AddColumns(cols =>
{
cols.Add("Select").WithValueExpression((p, c) => c.UrlHelper.Action("Select", "BranchPersonnelCategory", new { Moc_Service_Type = p.MOC_Service_Type, Moc_Personnel_Category = p.MOC_Personnel_Category, codeType = p.MOC_Code_Type }))
cols.Add("LU_ServiceCodeText").WithHeaderText("Service Code Text").WithSorting(true)
.WithValueExpression(p => p.LU_ServiceCodeText.ToString());

When i click the Select link then i want to load the partial view which loads another Grid.

I tried in the following way
-- in controller
public ActionResult Index()
{
return View();
}
--- In view

@Html.ActionLink("Create New", "Create")

@Html.Partial("_MVCGridToolbar", new MVCGrid.Web.Models.MVCGridToolbarModel() { MVCGridName = "LUServicePersonnelMOC", PageSize = true, ColumnVisibility = true, Export = true, GlobalSearch = true }) @Html.MVCGrid("LUServicePersonnelMOC")
</div>
<div class="tab-content">
    <div id="service" class="tab-pane fade in active">
        <h3>Service</h3>
        <p>@Html.Action("_Select",CONTROLLERNAME)</p>
    </div>
    <div id="moc" class="tab-pane fade">
        <h3>Moc</h3>
        <p>Some content in menu 1.</p>
    </div>
    <div id="personnel" class="tab-pane fade">
        <h3>Personnel</h3>
    </div>
</div>
<script src="~/Scripts/jquery-3.3.1.min.js"></script> <script> $(document).ready(function () { $("#MocTable").hide(); }); $('.confirmation').on('click', function () { return confirm('Are you sure?'); }); $('.GridSelect').on('click', function () { $('#MocTable').show(); }); </script>

-- In Controller

public ActionResult Select(string Moc_Service_Type, string Moc_Personnel_Category, string codeType)
{
return PartialView("_Select");
}

-- added new partial view name as _Select.html

@Html.Partial("_MVCGridToolbar", new MVCGrid.Web.Models.MVCGridToolbarModel() { MVCGridName = "MocGrid", PageSize = true, ColumnVisibility = true, Export = true, GlobalSearch = true }) @Html.MVCGrid("MocGrid")
</div>

How can i load _Select partial view to Index View through this process. ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant