어디서나 정확한 문제를 발견 할 수없는 Telerik 그리드에 문제가 있습니다. 나는 클라이언트 사이드 편집 템플릿을위한 그들의 사이트에서 데모를 따라 가고있다. 편집 모드로 전환하면 즉시 select
방법이에서 정의되지 말 다이 것은 문 JS :Telerik 그리드에서 MVC3 열의 드롭 다운 목록을 렌더링하지 않습니다.
Function GetPageContent() As ActionResult
Try
ViewData("PageList") = SharedListDataRepository.PageList()
Return PartialView()
Catch ex As Exception
Throw
End Try
End Function
: 여기
<%@ Control Language="VB" Inherits="System.Web.Mvc.ViewUserControl" %>
<%@ Import Namespace="Community_Portal_Admin" %>
<div class="gridFrame">
<% Html.Telerik().Grid(Of IndustryPageContent)() _
.Name("IndustryPageContent") _
.DataKeys(Function(k) k.Add(Function(d) d.ID)) _
.DataBinding(Function(db) db.Ajax() _
.Select("_GetPageContent", "Industry") _
.Update("_SetPageContent", "Industry")) _
.Columns(Function(c) c.Bound(Function(d) d.IndustryID)) _
.Columns(Function(c) c.Bound(Function(d) d.PageID)) _
.Columns(Function(c) c.Bound(Function(d) d.PageActionID)) _
.Columns(Function(c) c.Bound(Function(d) d.Content1)) _
.Columns(Function(c) c.Bound(Function(d) d.Content2)) _
.Columns(Function(c) c.Bound(Function(d) d.Content3)) _
.Columns(Function(c) c.Bound(Function(d) d.Content4)) _
.Columns(Function(c) c.Bound(Function(d) d.Content5)) _
.Columns(Function(c) c.Command(Function(d) d.Edit().ButtonType(GridButtonType.Image)).Width(60)) _
.Columns(Function(c) c.Bound(Function(d) d.ID).Hidden()) _
.ClientEvents(Function(e) e.OnEdit("onEdit")) _
.Editable(Function(c) c.Mode(GridEditMode.InForm).Enabled(True)) _
.Scrollable(Function(s) s.Height("350px")) _
.Pageable() _
.Selectable() _
.Render()
%>
<br />
<%: Html.ActionLink("Close", "Index", "Configuration", Nothing, New With {.class = "t-button", .Style = "font-size:12px;"})%>
</div>
<script type="text/javascript">
function onEdit(e) {
$(e.form).find('#PageList').data('tDropDownList').select(function (dataItem) {
return dataItem.Text == e.dataItem['PageName'];
});
}
</script>
내 컨트롤러 액션입니다 : 여기
<script type="text/javascript">
function onEdit(e) {
$(e.form).find('#PageList').data('tDropDownList').select(function (dataItem) {
return dataItem.Text == e.dataItem['PageName'];
});
}
</script>
내이다 다음은 목록 데이터를로드하는 도우미입니다.
Public Shared Function PageList() As IEnumerable(Of ApplicationPage)
Dim l As IEnumerable(Of ApplicationPage)
Try
l = (From d In New AdminIndustrySetupDataContext(TripleDESSecurity.Decrypt(SharedData.PortalCnx)).AdminApplicationPages Order By d.ID Select New ApplicationPage With {
.ID = d.ID,
.PageName = d.PageName
}).AsEnumerable
Return l
Catch ex As Exception
Throw
Finally
If Not l Is Nothing Then
l = Nothing
End If
End Try
End Function
여기 내 모델입니다 : 당신이 볼 수 있듯이, 뷰에 컨트롤을 가져 오려고하지만 에러는 "정의되지 않은"엘리먼트에 js 에러가 있기 때문에 UIHint
으로 장식되어 있습니다. 그것을 페이지에 표시합니다. 어떤 방화범이 끌려는 HTML 마지막으로 여기
Imports System.ComponentModel.DataAnnotations
Imports System.Runtime.Serialization
<KnownType(GetType(IndustryPageContent))> _
Public Class IndustryPageContent
<ScaffoldColumn(False)> _
Public Property ID As Integer = 0
Public Property IndustryID As Integer = 0
<UIHint("PageList"), Required()> _
Public Property PageID As Integer = 0
Public Property PageActionID As Integer = 0
Public Property Content1 As String = String.Empty
Public Property Content2 As String = String.Empty
Public Property Content3 As String = String.Empty
Public Property Content4 As String = String.Empty
Public Property Content5 As String = String.Empty
Public Sub New()
MyBase.New()
End Sub
End Class
그리고 그냥 거기 함께있어 동의한다 나의 목록 컨트롤입니다 :
<%@ Control Language="vb" Inherits="System.Web.Mvc.ViewUserControl" %>
<% Html.Telerik().DropDownList() _
.Name("PageList") _
.BindTo(New SelectList(CType(ViewData("PageList"), IEnumerable), "ID", "PageName"))
%>
그래서 내 생각 엔이 선택 방법에 대한 자바 스크립트 오류가 발생되는 것을
UIHint
ISN '때문에 컨트롤을 바인딩하여 컨트롤이 select 메서드를 호출하지 못하게합니다.
무엇이 누락 되었습니까? 면도기가 아닌 VB.NET과 aspx를 사용하여 Ajax 바인딩이 포함 된 Telerik 그리드를 성공적으로 구현 했습니까? 아니면 내가 작업해야하는 제한 사항이있는 구석에 페인트 칠 된 유일한 사람입니까?
Telerik 데모를 사용하는 데 문제가 있었지만 일관되게 불완전하거나 결국 지원하는 방법의 모순을 사용합니다. "이렇게하면 할 수 없습니다." 데모 ??
편집에서이
이 작동 그것을 가지고 내 그리드에 대한 최종 코드 :
<% Html.Telerik().Grid(Of IndustryPageContent)() _
.Name("IndustryPageContent") _
.DataKeys(Function(k) k.Add(Function(d) d.ID)) _
.DataBinding(Function(db) db.Ajax() _
.Select("_GetPageContent", "Industry") _
.Update("_SetPageContent", "Industry")) _
.Columns(Function(c) c.Bound(Function(d) d.IndustryID)) _
.Columns(Function(c) c.Bound(Function(d) d.PageID)) _
.Columns(Function(c) c.Bound(Function(d) d.PageActionID)) _
.Columns(Function(c) c.Bound(Function(d) d.Content1)) _
.Columns(Function(c) c.Bound(Function(d) d.Content2)) _
.Columns(Function(c) c.Bound(Function(d) d.Content3)) _
.Columns(Function(c) c.Bound(Function(d) d.Content4)) _
.Columns(Function(c) c.Bound(Function(d) d.Content5)) _
.Columns(Function(c) c.Command(Function(d) d.Edit().ButtonType(GridButtonType.Image)).Width(60)) _
.Columns(Function(c) c.Bound(Function(d) d.ID).Hidden()) _
.Editable(Function(c) c.Mode(GridEditMode.InForm).Enabled(True)) _
.Scrollable(Function(s) s.Height("350px")) _
.Pageable() _
.Selectable() _
.Render()
%>
ClientEvents
라인과 JS는 "이름"필요하지 않습니다. 재산 드롭 다운 목록의 y는 목록이 될 속성의 이름과 일치해야합니다. 이 경우 PageID
및 PageActionID
입니다. 이것은 내가 정의한 2 개의 DDL에 대한 코드입니다.
<%@ Control Language="vb" Inherits="System.Web.Mvc.ViewUserControl" %>
<% Html.Telerik().DropDownList() _
.Name("PageID") _
.BindTo(New SelectList(CType(ViewData("PageList"), IEnumerable), "ID", "PageIDandName")) _
.Render()
%>
<%@ Control Language="vb" Inherits="System.Web.Mvc.ViewUserControl" %>
<% Html.Telerik().DropDownList() _
.Name("PageActionID") _
.BindTo(New SelectList(CType(ViewData("PageActionList"), IEnumerable), "PageActionID", "PageActionIDandAction")) _
.Render()
%>
여기에 코드를 잘못 붙여 넣었습니다. 실제로 사용하는 코드는 위의 편집 된 질문에 있습니다. 작업을 떠나기 전에 금 (Fri)에 제안한 프로젝트를 체크 아웃했으나 그리드에서 드롭 다운 목록 편집을 수행하는 방법을 완전히 다른 방식으로 구현 한 것으로 나타났습니다. 데모에서 게시 된 예제가 예상대로 작동하지 않는 이유는 무엇입니까? –
온라인 예제는 탐색 할 때 작동합니까? 새 프로젝트는 단순화 된 버전이며 온라인 데모를 똑같이 보이게 할 것입니다. –
Atanas, 당신이 보려고 제안한 프로젝트는 내 모델을 손상시키는 강력한 형식의 드롭 다운 목록을 사용하기 때문에 상황을 더욱 어렵게 만듭니다. 나는 그것을 바꿀 수 없다. 그래서 나는 클라이언트 행 편집 데모와 샘플을 선택했다. 렌더링 메소드를 추가하면 drowdown을 볼 수 있지만, 실제로는 선택에 따라 업데이트를 수행하지 못한다. 프로젝트를 다시 압축하여 지원 티켓을 통해 보내 드리겠습니다. –