- Home
- Forum
- ASP.NET MVC (Classic)
- Grid problem with unbound column with link
Grid problem with unbound column with link
Hi
I have little problem, used search but no solution found
I found this "<a class=\"TemplateCell\" rel='nofollow' href=\"Home/DeleteRecord?id={OrderID}\">Delete")" to enter under format, but its a no go (even tryed to modify it) i found this here http://www.syncfusion.com/support/forums/grid-mvc/101958
This is my code, i get all the data as i want, but cant get Id of Customer to edit it when i click on Edit button
It's probably something simple that i missed....
@ModelType IEnumerable(Of WebRacun.Kupac)
@Code
ViewData("Title") = "Index"
Layout = "~/Views/Shared/_Layout.vbhtml"
End Code
<h2>Popis kupaca</h2>
<p>
</p>
@Code
Dim gridBuilder = Html.Syncfusion().Grid(Of WebRacun.Kupac)("PopisKupaca").Datasource(Model).ActionMode(ActionMode.Server).SelectionMode(SelectionMode.Single)
gridBuilder.Column(Function(cols) cols.Add("Opcije").HeaderText("Opcije").Width(60).Format("<a rel='nofollow' href=\customers\edit\ Need to insert customer ID here ">Edit</a>""))
gridBuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As WebRacun.Kupac) c.Id).HeaderText("Id").Width(30))
gridBuilder.Column(Function(cols) cols.Add(Of String)(Function(c As WebRacun.Kupac) c.Naziv).HeaderText("Naziv").Width(150))
gridBuilder.Column(Function(cols) cols.Add(Of String)(Function(c As WebRacun.Kupac) c.UlicaKbr).HeaderText("Adresa").Width(150))
gridBuilder.Column(Function(cols) cols.Add(Of String)(Function(c As WebRacun.Kupac) c.PostanskiBrojGrad).HeaderText("Grad").Width(150))
gridBuilder.EnablePaging()
gridBuilder.EnableGrouping()
gridBuilder.EnableSorting()
gridBuilder.Render()
End Code
I have little problem, used search but no solution found
I found this "<a class=\"TemplateCell\" rel='nofollow' href=\"Home/DeleteRecord?id={OrderID}\">Delete")" to enter under format, but its a no go (even tryed to modify it) i found this here http://www.syncfusion.com/support/forums/grid-mvc/101958
This is my code, i get all the data as i want, but cant get Id of Customer to edit it when i click on Edit button
It's probably something simple that i missed....
@ModelType IEnumerable(Of WebRacun.Kupac)
@Code
ViewData("Title") = "Index"
Layout = "~/Views/Shared/_Layout.vbhtml"
End Code
<h2>Popis kupaca</h2>
<p>
</p>
@Code
Dim gridBuilder = Html.Syncfusion().Grid(Of WebRacun.Kupac)("PopisKupaca").Datasource(Model).ActionMode(ActionMode.Server).SelectionMode(SelectionMode.Single)
gridBuilder.Column(Function(cols) cols.Add("Opcije").HeaderText("Opcije").Width(60).Format("<a rel='nofollow' href=\customers\edit\ Need to insert customer ID here ">Edit</a>""))
gridBuilder.Column(Function(cols) cols.Add(Of Integer)(Function(c As WebRacun.Kupac) c.Id).HeaderText("Id").Width(30))
gridBuilder.Column(Function(cols) cols.Add(Of String)(Function(c As WebRacun.Kupac) c.Naziv).HeaderText("Naziv").Width(150))
gridBuilder.Column(Function(cols) cols.Add(Of String)(Function(c As WebRacun.Kupac) c.UlicaKbr).HeaderText("Adresa").Width(150))
gridBuilder.Column(Function(cols) cols.Add(Of String)(Function(c As WebRacun.Kupac) c.PostanskiBrojGrad).HeaderText("Grad").Width(150))
gridBuilder.EnablePaging()
gridBuilder.EnableGrouping()
gridBuilder.EnableSorting()
gridBuilder.Render()
End Code
SIGN IN To post a reply.
2 Replies
HJ
Hariharan J V
Syncfusion Team
January 9, 2014 01:02 PM UTC
Hi Andrej Skvorc,
Thanks for using Syncfusion products.
We are sorry about the inconvenience caused.
Currently we are working on this and we will update you on Jan 13, 2014. We thank you for your patience in advance.
Please let us know if you need any further assistance.
Regards,
Hariharan J.V.
HJ
Hariharan J V
Syncfusion Team
January 13, 2014 09:27 AM UTC
Hi Andrej Skvorc,
Thanks for your patience.
We have created a simple sample to achieve your requirement("Need to get Id of Customer to edit/Delete it when i click on Edit/Delete button") and When click the Delete button it will pass the id(Universitycode) to the controller action and then it displayed in the partial view. Please refer the below code snippets.
[GridController.vb]
Public Function Delete(ByVal id As Long) As ActionResult
If ModelState.IsValid Then
Models.OrderRepository.Delete(id)
End If
ViewData("DataID") = id
Return View()
End Function
[GridFeatures.vbhtml]
@code
Dim gridbuilder = Html.Syncfusion.Grid(Of Student)("GenericListGrid").Datasource(Model)
gridbuilder.Datasource(Model)
'add grid columns using gridbuilder
gridbuilder.Column(Function(cols) cols.Add(Of Long)(Function(c As Student) c.UniversityCode).HeaderText("University Code").Width(130).AllowEditing(true))
gridbuilder.Column(Function(cols) cols.Add(Of System.Nullable(Of Date))(Function(c As Student) c.BirthDate).HeaderText("BirthDate").Width(130))
gridbuilder.Column(Function(cols) cols.Add(Of String)(Function(c As Student) c.FirstName).HeaderText("FirstName").Width(130))
gridbuilder.Column(Function(cols) cols.Add(Of String)(Function(c As Student) c.LastName).HeaderText("LastName").Width(120))
gridbuilder.Column(Function(cols) cols.Add("Delete").HeaderText("Delete Record").Format("<a class=""TemplateCell"" rel='nofollow' href=""/Grid/Delete?id={UniversityCode}"">Delete</a>"))
Endcode
And the same sample can be downloaded from the below link.
Sample: http://www.syncfusion.com/downloads/support/directtrac/general/MvcApplication12-881913856.zip
Please let us know if you need any further assistance.
Regards,
Hariharan J.V.
SIGN IN To post a reply.
- 2 Replies
- 2 Participants
-
AS Andrej Skvorc
- Jan 3, 2014 10:55 PM UTC
- Jan 13, 2014 09:27 AM UTC