I'm working on a simple webgrid that has 3 columns:
View
columns: grid.Columns(
grid.Column("Applicant Name",
format: (item) => @Html.ActionLink((string)item.Name, "EditApplicant", "Applicant", new { id = item.ApplicantId },
null), style: "AppName")
, grid.Column("Role", "Role", style: "Role")
, grid.Column("ApplicantSkills", "Skills", style: "AppSkills")
I've been trying to set fixed widths for my columns. I've experimented with percentage and exact pixel widths like 500px, 100px, etc., and they initially work but get reset after postback.
css:
.AppSkills {
width: 70%;
}
.AppName {
width: 20%;
}
.Role {
width: 10%;
}
The grid I'm working on displays search results based on various filters selected by the user. Each time different filters are chosen and a search is performed, the results change and the grid is updated. However, I'm encountering an issue where the column widths of the grid are not being preserved. Initially, everything looks good, but after applying filters and searching again, the column widths change.
I've tried submitting my form using both GET and POST methods to see if the formatting gets lost during the process. Unfortunately, both approaches result in the same issue.
@using (Html.BeginForm("Search", "Home", FormMethod.Post))
{
Am I missing something obvious here? Is there a way to ensure that the grid columns maintain a fixed width without shifting around?