This question is locked. New answers and comments are not allowed.
Hi. I am new with mvc. I am a windows form vb.net experienced programmer doing the jump to a mvc project.
I am using the telerik extensions for mvc 3 and razor.
I have been able to do a lot in a short time, but now i am stuck when it comes times to replace a fkID in a bound column by its DisplayText from a dropdownList.
http://imageshack.us/photo/my-images/685/part1gt.png/
I also want to see the dropdown in the edit
http://imageshack.us/photo/my-images/502/part2h.png/
i was able to put a dropdown list on my view which containes all the Villes but it was on top of the view, not in the columns
in my model, my CITY_ID is defined as such
<DisplayName("Ville")> _
<UIHint("Cities"), Required()>
Public Property CITY_ID As Nullable(Of Integer)
Get
Return _cityId
End Get
Set(value As Nullable(Of Integer))
_cityId = value
End Set
End Property
In my Controller,
i feed this viewData before return the view
ViewData("Cities") = _db.GEO_CITY.ToList
In my View
Dim Cities = ViewData("Cities") i create a variable to hold my cities
and then i declare my grid
Html.Telerik.Grid(Model).Name("Grid") _
.ColumnContextMenu() _
.DataKeys(Sub(keys)
keys.Add("Id")
End Sub) _
.ToolBar(Sub(commandes)
commandes.Insert.ButtonType(type).ImageHtmlAttributes(New With {.style = "margin-left:0"})
End Sub) _
.DataBinding(Sub(databinding)
databinding.Ajax() _
.Select("_AjaxIndex", "Fournisseurs") _
.Insert("_InsertAjaxEditing", "Fournisseurs") _
.Update("_AjaxEdit", "Fournisseurs") _
.Delete("_DeleteAjaxEditing", "Fournisseurs")
End Sub) _
.Columns(Sub(column)
column.Bound("Code").Width(100)
column.Bound("Nom").Width(100)
column.Bound("ADDRESS").Width(200)
column.Bound("CITY_ID").Width(100).ClientTemplate("<#= Cities.Name#>")
column.Bound("TEL").Width(100)
column.Bound("FAX").Width(100)
column.Bound("ZIPCODE").Width(100)
column.Command(Sub(commandes)
commandes.Edit.ButtonType(type)
commandes.Delete.ButtonType(type)
End Sub).Width(180).Title("Commands")
End Sub) _
.Editable(Function(ee) ee.Mode(mode)) _
.Pageable _
.Scrollable _
.Sortable() _
.Render()
It all works except for the dropdownlist which is not displayed nor is it used.
Anyone can help ?
thanks a happy holidays
I am using the telerik extensions for mvc 3 and razor.
I have been able to do a lot in a short time, but now i am stuck when it comes times to replace a fkID in a bound column by its DisplayText from a dropdownList.
http://imageshack.us/photo/my-images/685/part1gt.png/
I also want to see the dropdown in the edit
http://imageshack.us/photo/my-images/502/part2h.png/
i was able to put a dropdown list on my view which containes all the Villes but it was on top of the view, not in the columns
in my model, my CITY_ID is defined as such
<DisplayName("Ville")> _
<UIHint("Cities"), Required()>
Public Property CITY_ID As Nullable(Of Integer)
Get
Return _cityId
End Get
Set(value As Nullable(Of Integer))
_cityId = value
End Set
End Property
In my Controller,
i feed this viewData before return the view
ViewData("Cities") = _db.GEO_CITY.ToList
In my View
Dim Cities = ViewData("Cities") i create a variable to hold my cities
and then i declare my grid
Html.Telerik.Grid(Model).Name("Grid") _
.ColumnContextMenu() _
.DataKeys(Sub(keys)
keys.Add("Id")
End Sub) _
.ToolBar(Sub(commandes)
commandes.Insert.ButtonType(type).ImageHtmlAttributes(New With {.style = "margin-left:0"})
End Sub) _
.DataBinding(Sub(databinding)
databinding.Ajax() _
.Select("_AjaxIndex", "Fournisseurs") _
.Insert("_InsertAjaxEditing", "Fournisseurs") _
.Update("_AjaxEdit", "Fournisseurs") _
.Delete("_DeleteAjaxEditing", "Fournisseurs")
End Sub) _
.Columns(Sub(column)
column.Bound("Code").Width(100)
column.Bound("Nom").Width(100)
column.Bound("ADDRESS").Width(200)
column.Bound("CITY_ID").Width(100).ClientTemplate("<#= Cities.Name#>")
column.Bound("TEL").Width(100)
column.Bound("FAX").Width(100)
column.Bound("ZIPCODE").Width(100)
column.Command(Sub(commandes)
commandes.Edit.ButtonType(type)
commandes.Delete.ButtonType(type)
End Sub).Width(180).Title("Commands")
End Sub) _
.Editable(Function(ee) ee.Mode(mode)) _
.Pageable _
.Scrollable _
.Sortable() _
.Render()
It all works except for the dropdownlist which is not displayed nor is it used.
Anyone can help ?
thanks a happy holidays