Question

I'm trying to render an Infragistics Grid as part of my view in my MVC application. However, I'm trying to do the following:

@(Html.Infragistics()
        .Grid(Model)
        .ID("grid")
        .Width("100%")
        .Height("500px")
        .PrimaryKey("ID")
        .AutoGenerateColumns(false)
        .AutoGenerateLayouts(false)
        .Columns(column =>
        {
            column.For(x => x.omkt).HeaderText("OMKT").Width("30%");
            column.For(x => x.dmkt).HeaderText("DMKT").Width("30%");
            column.For(x => x.ibu).HeaderText("IBU").Width("20%");
            column.For(x => x.count_total).HeaderText("COUNT_ALL").Width("20%");
        })
        .Features(features =>
        {
            features.Sorting().Type(OpType.Remote);
            features.Paging().Type(OpType.Remote);
            features.Filtering().Type(OpType.Remote);
        })
        .DataSourceUrl(Url.Action("GetMarketAreaData?ibu=" + ViewBag.IBU + "&sort=" + ViewBag.sort + "&startDate=" + ViewBag.startDate + "&endDate=" + ViewBag.endDate))
        .Render()
    )

The problem is on the DataSourceUrl line, where it's transforming all the ? and & characters into their escape sequences. Using \ doesn't work either, as I get a parser error for an unrecognized escape sequence. The reason why I need this, though, is because all of those are passed in as parameters into the controller function in order to pull the correct data.

As a result, I'm getting a 400 error when pulling the data. Is there any way to force the action to recognize ? characters for ? characters?

Was it helpful?

Solution

Found the answer: I needed to pass in a second parameter into Url.Action with all the parameters.

.DataSourceUrl(Url.Action("GetMarketAreaData", new { ibu = ViewBag.IBU, sort = ViewBag.sort, startDate = ViewBag.startDate, endDate = ViewBag.endDate }))
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top