2

I've got a view with 3 partial views inside of it. The first partial view has a @using reference to a ViewModel and it turns out this is causing the grids to be misaligned.

I haven't been able to find anything related to this online and am wasting so much time trying to figure out such a trivial thing. Why is this happening?

The Grids: enter image description here

The Partial View: enter image description here

The HTML: Whats going on here...

Edit: For future reference, here was the code at the top of my partial view -

@using Project.Web.Areas.Admin.Models



@functions{

    object GetEditingProduct(ASPxGridView grid)
    {
        if (grid.IsNewRowEditing)
            return new CustomerGroupViewModel();
        return grid.GetRow(grid.EditingRowVisibleIndex);
    }

}
ErpaDerp
  • 780
  • 1
  • 7
  • 16
  • 1
    Answers to [this SO question](https://stackoverflow.com/questions/9691771/why-is-65279-appearing-in-my-html) or [this](https://stackoverflow.com/questions/6538203/how-to-avoid-echoing-character-65279-in-php-this-question-also-relates-to-java) may well help – RickL Apr 13 '18 at 02:31
  • Need more infomation – Shahzad Khan Apr 13 '18 at 02:44
  • Razor code is processed server side, never rendered directly to the browser. It's not realistic for that to be affecting the page layout, unless it produces some HTML output. Since this is just a function, and does itself produce any output (until it's called, elsewhere), then it's highly unlikely this is the cause of the problem. P.S. Please don't post images of code, it makes it impossible for anyone to re-use it either in an answer or to try and reproduce the issue. Don't make extra work for the volunteers trying to help you. Besides, cut/paste text should be easier than making a picture! – ADyson Apr 13 '18 at 09:18
  • Well, you're not including all code portions of the grid which misaligned against other `GridViewExtension` helpers, try include the view page and partial views used to build those grids shown in picture. – Tetsuya Yamamoto Apr 13 '18 at 11:40
  • Sorry, I should have given more information. The reason I thought it was the @using statement is because I had commented it out before and it seemed to fix it. Later on I was unable to repeat it. I will post the code, my mistake! – ErpaDerp Apr 13 '18 at 17:49
  • RickL was spot on! I had copied and pasted that function from devexpress and it had a bad invisible character in it. – ErpaDerp Apr 13 '18 at 17:52

1 Answers1

0

So RickL pointed me in the right direction. I had copied and pasted my function from a website and it turns out there was some bad character in there. Deleting the empty space fixed it.

now with no spaces -

@using Project.Web.Areas.Admin.Models
@functions{
    object GetEditingProduct(ASPxGridView grid)
    {
        if (grid.IsNewRowEditing)
            return new CustomerGroupViewModel();
        return grid.GetRow(grid.EditingRowVisibleIndex);
    }
}
ErpaDerp
  • 780
  • 1
  • 7
  • 16