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

ItemsToDisplay #400

Open
kimiyon27 opened this issue Nov 22, 2023 · 6 comments
Open

ItemsToDisplay #400

kimiyon27 opened this issue Nov 22, 2023 · 6 comments

Comments

@kimiyon27
Copy link

I am using to grid in asp.net mvc core there is an samples for ItemToDisplay in example application but don't know how display data in frontend I am using web and webapi facing problem in passing query to api and also passing ISGrid to web can't able to serialize and deserialize the data plz give me some help

@gustavnavar
Copy link
Owner

You must use the GridClient object in the front-end to display the ItemToDisplay serialized object sent by the back-end.

You can follow this guide: https://github.com/gustavnavar/Grid.Blazor/blob/master/docs/blazor_client/Quick_start.md

@Mohammedyasith
Copy link

Thank you @gustavnavar but now am facing another issue when ever I applying some filter the value was not passed to the api

var query = new QueryDictionary();
query.Add("grid-page", "2");
var client = new GridClient(HttpClient, url, query, false, "ordersGrid", Columns);
_grid = client.Grid;

every time the query obj(query) we send from here is received not we applied one

@Mohammedyasith
Copy link

program.cs file
services.AddHttpContextAccessor();
razor file

@Inject IHttpContextAccessor HttpContextAccessor

   var query = HttpContextAccessor.HttpContext.Request.Query;
    var dictionary = ConvertToDictionary(query);
    var clients = new GridClient<WorkflowsModel>(HttpClient, "app/Data", dictionary, false, "appGrid", Columns)
                .Sortable()
                .Filterable()
                .WithMultipleFilters();

public static QueryDictionary ConvertToDictionary(IQueryCollection queryCollection)
{
var dictionary = new QueryDictionary();

    foreach (var kvp in queryCollection)
    {
        dictionary.Add(kvp.Key, kvp.Value);
    }
    return dictionary;
}

@Mohammedyasith
Copy link

Is this right

@gustavnavar
Copy link
Owner

I cant not see what is wrong in your code.

Could you open a new issue attaching the a visual studio project with your code?

@Mohammedyasith
Copy link

Its working fine

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

3 participants