Hi!
If I enter a value in the Perday Price or Total Price fields with a decimal .00, it removes the .00, but if we go back (before clicking save) and add the 1.00 back, it takes it.
I was thinking that if we can set “validateOnBlur” to false then it might prevent the auto-correction from happening as well. The problem is that I can’t figure out how to do this.
http://docs.kendoui.com/api/framework/validator#configuration-validateOnBlur
<fieldset>
<legend>Topline Price Information</legend>
@(Html.Kendo().Grid<Presentation.Web.Models.TopLinePrice>()
.Name("Grid")
.Columns(columns =>
{
columns.Bound(m => m.ProjectNumber)
.Title(ScanDataResources.ProjectNumber)
.Width(120);
columns.Bound(m => m.ClientName)
.Title(ScanDataResources.ClientIdName);
columns.Bound(m => m.PerDayPrice)
.Title(ScanDataResources.PerDayPriceName)
.Format("{0:c2}")
.Width(100);
columns.Bound(m => m.TotalPrice)
.Title(ScanDataResources.TotalPriceName)
.Format("{0:c2}")
.Width(100);
columns.Bound(m => m.IsPriceOverridableDescription)
.Title(ScanDataResources.Overriden)
.Visible((int)@ViewBag.SystemId == (int)CoreConstants.PWSystem.RAMS)
.Width(75);
columns.Bound(m => m.LastSentDate)
.Title(ScanDataResources.ModifiedDate)
.Width(180);
columns.Bound(m => m.ModifiedByPersonName)
.Title(ScanDataResources.ModifiedByName)
.Width(120);
columns.Command(commands => commands.Edit()
.Text(@Buttons.Edit).HtmlAttributes(new { @Style = "text-align:center; " })
.CancelText(@Buttons.Cancel)
.UpdateText(@Buttons.Save)
).Title("")
.Width(160);
})
.Events(e => e.Save("OnSave"))
.Events(e => e.Edit("OnEdit"))
.Editable(editable => editable.Mode(GridEditMode.InLine)) // Use inline editing mode
.DataSource(dataSource =>
dataSource.Ajax()
.Model(model =>
{
model.Id(p => p.ProjectPriceId); // Specify the property which is the unique identifier of the model
model.Field(p => p.ProjectNumber).Editable(false); // Make the ProjectNumber property not editable
model.Field(p => p.LastSentDate).Editable(false);
})
.Read(read => read
.Action("GetScanDataTopLinePrice", "ScanDataTopLinePrice")
.Data("ScanData.GetSearchModel")) // Action invoked when the grid needs data
.Update(update => update
.Action("UpdatePrice", "ScanDataTopLinePrice")) // Action invoked when the user saves an updated data item
.Events(events => events.RequestEnd("OnRequestEnd_TopLinePriceGrid"))
.PageSize(10)
)
)
</fieldset>
<script type="text/javascript">
function OnEdit(e) {
$('#PerDayPrice').change(function () {
var perDayPrice = $(this).val();
var isDecimalFound = perDayPrice % 1 != 0;
if (!isDecimalFound) {
$(this).val(perDayPrice + '.00');
}
});
$('#TotalPrice').change(function () {
var totalPrice = $(this).val();
var isDecimalFound = totalPrice % 1 != 0;
if (!isDecimalFound) {
$(this).val(totalPrice + '.00');
}
});
// Clear validation errors.
e.container.find('.k-grid-cancel').bind('click', function() {
Validation.ClearValidationErrors('MainValidationSummary');
});
}
</script>
Thanks
<
style type="text/css">
.CursorHand
{
cursor: hand;
}
</
style>
<
telerik:GridHyperLinkColumn UniqueName="HyperLinkColumn" DataNavigateUrlFormatString="Review"
ItemStyle-Font-Underline="true" ItemStyle-CssClass="CursorHand">
<ItemStyle Width="10%" />
<HeaderStyle Width="9%" />
</telerik:GridHyperLinkColumn>
protected void Page_Load(object sender, EventArgs e)
{
RGgrid.Attributes.Add(
"onmouseover","this.style.cursor='hand'");
}
In both of the cases I got the same result:
Waiting for the reply
With regards:
Dayana

I have a radfileexplorer with three custom columns that are created like this:
// Sets up a gridTemplateColumn for the Owner
GridTemplateColumn gtcOwner = new GridTemplateColumn();
gtcOwner.HeaderText = "Owner Name";
gtcOwner.UniqueName = "Owner";
gtcOwner.DataField = "Owner";
gtcOwner.SortExpression = "Owner";
rfe.Grid.Columns.Add(gtcOwner);
// Set up a gridTemplateColumn for the upload date
GridTemplateColumn gtcDate = new GridTemplateColumn();
gtcDate.HeaderText = "Date";
gtcDate.UniqueName = "Date";
gtcDate.DataField = "Date";
gtcDate.SortExpression = "Date";
rfe.Grid.Columns.Add(gtcDate);
//Sets up gridTemplateColumn for Visibility
GridTemplateColumn gtcPermission = new GridTemplateColumn();
gtcPermission.HeaderText = "Permission";
gtcPermission.UniqueName = "Visibility";
gtcPermission.DataField = "Visibility";
gtcPermission.SortExpression = "Visibility";
gtcPermission.HeaderStyle.Width = Unit.Pixel(72);
rfe.Grid.Columns.Add(gtcPermission);
When I click the column header the sort icon changes and the content sorts once. Subsequent clicks produce no change. The filename and size columns sort as expected.