This question is locked. New answers and comments are not allowed.
Thanks for very quick response before!
I have encountered another problem on grid.
After upgrading from 2009 Q3 to 2010 Q1. There is a datepicker error.
The error exist in telerik.grid.filtering.js
line 124:
Break on ErrorCopy
$(filterMenuHtml.string()).appendTo(this.element).find(".t-datepicker").tDatePicker is not a function
My code Controller:
==================
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Mvc.Ajax;
using AMDB2.Data.DataAccess;
using AMDB2.Data.DataAccess.Repository;
using AMDB2.Service;
using AMDB2.Service.Validation;
using AMDB2;
using Telerik.Web.Mvc;
using Telerik.Web.Mvc.UI;
namespace AMDB2.Controllers
{
[Authorize()]
public partial class INFO_COLUMNController : Controller
{
//[SourceCodeFile("EditableCustomer (model)", "~/Models/EditableCustomer.cs")]
//[SourceCodeFile("SessionCustomerRepository", "~/Models/SessionCustomerRepository.cs")]
public ActionResult TelerikGrid()
{
return View(_baseService.listINFO_COLUMNs());
}
[GridAction]
public ActionResult _SelectAjaxEditing()
{
return View(new GridModel(_baseService.listINFO_COLUMNs()));
}
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult _SaveAjaxEditing(string COLUMN_NAME, string SPEC_TABLE_NAME )
{
if (Globals.logMode == LogType.Debug) LogService.logFunctionBegin(System.Reflection.MethodBase.GetCurrentMethod(), AppHelper.GetCurrentUserString(), AppHelper.GetCurrentTXString()
, new object[] { COLUMN_NAME, SPEC_TABLE_NAME });
tx = _baseService.BeginTransaction();
var db_item = _baseService.GetINFO_COLUMN(COLUMN_NAME, SPEC_TABLE_NAME);
TryUpdateModel<INFO_COLUMN>(db_item);
ViewData["OperationMode"] = OperationMode.Edit;
if (_baseService.EditINFO_COLUMN(ref db_item, AppHelper.GetCurrentUser(), AppHelper.GetCurrentTX()))
{
tx.Commit();
_baseService.reset_object_context();
return View(new GridModel(_baseService.listINFO_COLUMNs()));
}
tx.Rollback();
return View(new GridModel(_baseService.listINFO_COLUMNs()));
}
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult _InsertAjaxEditing()
{
if (Globals.logMode == LogType.Debug) LogService.logFunctionBegin(System.Reflection.MethodBase.GetCurrentMethod(), AppHelper.GetCurrentUserString(), AppHelper.GetCurrentTXString()
, new object[] {});
tx = _baseService.BeginTransaction();
var db_item = new INFO_COLUMN();
TryUpdateModel<INFO_COLUMN>(db_item);
ViewData["OperationMode"] = OperationMode.Create;
if (_baseService.CreateINFO_COLUMN(db_item, AppHelper.GetCurrentUser(), AppHelper.GetCurrentTX()))
{
tx.Commit();
_baseService.reset_object_context();
return View(new GridModel(_baseService.listINFO_COLUMNs()));
}
tx.Rollback();
return View(new GridModel(_baseService.listINFO_COLUMNs()));
}
[AcceptVerbs(HttpVerbs.Post)]
[GridAction]
public ActionResult _DeleteAjaxEditing(string COLUMN_NAME, string SPEC_TABLE_NAME)
{
if (Globals.logMode == LogType.Debug) LogService.logFunctionBegin(System.Reflection.MethodBase.GetCurrentMethod(), AppHelper.GetCurrentUserString(), AppHelper.GetCurrentTXString()
, new object[] {});
tx = _baseService.BeginTransaction();
var db_item = _baseService.GetINFO_COLUMN(COLUMN_NAME, SPEC_TABLE_NAME);
if (_baseService.DeleteINFO_COLUMN(db_item, AppHelper.GetCurrentUser(), AppHelper.GetCurrentTX()))
{
tx.Commit();
_baseService.reset_object_context();
return View(new GridModel(_baseService.listINFO_COLUMNs()));
}
tx.Rollback();
return View(new GridModel(_baseService.listINFO_COLUMNs()));
}
}
}
My View Code
==============
<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<IEnumerable<AMDB2.Data.DataAccess.INFO_COLUMN>>" %>
<%@ Import Namespace="Helpers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
Edit
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<%= Html.Telerik().Grid(Model)
.Name("Grid")
.DataKeys(keys =>
{
keys.Add(c => c.COLUMN_NAME);
keys.Add(c => c.SPEC_TABLE_NAME);
})
.Toolbar(commands => commands.Insert())
.DataBinding(dataBinding =>
{
dataBinding.Ajax()
.Select("_SelectAjaxEditing", "INFO_COLUMN")
.Insert("_InsertAjaxEditing", "INFO_COLUMN")
.Update("_SaveAjaxEditing", "INFO_COLUMN")
.Delete("_DeleteAjaxEditing", "INFO_COLUMN");
})
.Columns(columns =>
{
columns.Bound(c => c.COLUMN_NAME);
columns.Bound(c => c.SPEC_TABLE_NAME);
columns.Bound(c => c.CODE_TABLE_QUERY);
columns.Bound(c => c.CODE_TABLE_NAME);
//columns.Bound(c => c.BirthDay).Width(130).Format("{0:d}");
columns.Command(commands =>
{
commands.Edit();
commands.Delete();
}).Width(180);
})
.Sortable()
.Filterable()
%>
<% Html.Telerik().ScriptRegistrar().OnDocumentReady(() => {
%> $('.insert-button').click(function(e) {
e.preventDefault();
$('#Grid').data('tGrid').createRow();
});
<% }); %>
</asp:content>
<asp:content contentplaceholderid="HeadContent" runat="server">
<style type="text/css">
.field-validation-error
{
position: absolute;
display: block;
}
* html .field-validation-error { position: relative; }
*+html .field-validation-error { position: relative; }
.field-validation-error span
{
position: absolute;
white-space: nowrap;
color: red;
padding: 17px 5px 3px;
background: transparent url('<%= Url.Content("~/Content/Common/validation-error-message.png") %>') no-repeat 0 0;
}
</style>
</asp:Content>