Question

I'm trying to create a link to edit each entry in a web grid but when I click on the link it append "%20%20%20%20%20%20%20%20%20%20%20%20%20" to the end of the url. I have no idea why this is happening. The link works find if I remove the "%20%20%20%20%20%20%20%20%20%20%20%20%20" in the browser address bar.

<div class="divGridHistory">
     @historyDataGrid.GetHtml("webGridStyle",
        rowStyle: "gridrow",
        alternatingRowStyle: "altgridrow",
        selectedRowStyle: "webGridSelectedRow",
        displayHeader: true,
        htmlAttributes: new { id = "dedDetailDataGrid" },
        columns: historyDataGrid.Columns(
            historyDataGrid.Column("ControlGroupId", "Control Group ID", style: "webGridGroupId"),
            historyDataGrid.Column("OrganizationId", "Organization ID", style: "webGridOrganizationId"),
            historyDataGrid.Column("AleIndicator", "ALE Indicator", style: "webGridAleIndicator"),
            historyDataGrid.Column("EffectiveDate","Effective Date", style: "webGridStartDate", format: item => @Utility.FormatShortDate(item.EffectiveDate)),
            historyDataGrid.Column("ChangeReason","Change Reason", style: "webGridChangeReason"),
            historyDataGrid.Column("Edit",format:@<text>@Html.ActionLink("Edit","EditOrganizationAle","AleCalculation",new{id = Model.OrganizationId},"")</text>)
            ))
</div>
Was it helpful?

Solution

You might try trimming the parameter:

new { id = Model.OrganizationId.Trim() }

OTHER TIPS

I think the reason for this is the field type you specified within the database. You probably use a char type with a fixed length (so it will be filled with spaces). If you use VarChar instead, it won't append the string with spaces.

Like p.s.w.g said, you can Trim() it, but that's only a work around.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top