Hello everybody,
I'm building a grid with edit and delete options.
In the edit option i need to show only some of the fields i have available in the grid for update, but i'm having problems achieving this.
I saw several examples in the forum but i can't put it to work in my project
I'm populating the grid on run time this way:
| '. Preencher a Grid |
| rg_shoppinglist.DataSourceID = "SqlDataSource1" |
| SqlDataSource1.SelectParameters.Item("idClient").DefaultValue = "1" |
| rg_shoppinglist.MasterTableView.DataKeyNames = New String() {"idwebchart"} |
| rg_shoppinglist.Width = Unit.Percentage(98) |
| rg_shoppinglist.PageSize = 5 |
| rg_shoppinglist.AllowPaging = True |
| rg_shoppinglist.PagerStyle.Mode = GridPagerMode.NextPrevAndNumeric |
| rg_shoppinglist.AutoGenerateColumns = False |
| rg_shoppinglist.AutoGenerateEditColumn = True |
| rg_shoppinglist.AutoGenerateDeleteColumn = False |
| rg_shoppinglist.AllowSorting = True |
| rg_shoppinglist.Skin = "Sunset" |
| rg_shoppinglist.EnableViewState = True |
| '. Configurar |
| Dim boundColumn As GridBoundColumn |
| '. ReferĂȘncia |
| boundColumn = New GridBoundColumn() |
| rg_shoppinglist.MasterTableView.Columns.Add(boundColumn) |
| boundColumn.DataField = "ref" |
| boundColumn.HeaderText = "ReferĂȘncia" |
| boundColumn.EditFormColumnIndex = False |
| Dim myEdit As Boolean = boundColumn.IsEditable |
| '. Designação |
| boundColumn = New GridBoundColumn() |
| rg_shoppinglist.MasterTableView.Columns.Add(boundColumn) |
| boundColumn.DataField = "description" |
| boundColumn.HeaderText = "Designação" '. MORE FIELDS ETC ETC ETC...... |
After this i tryed doing somethign like this:
| Protected Sub rg_shoppinglist_ItemCommand(ByVal source As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles rg_shoppinglist.ItemCommand |
| Dim val As Object |
| If e.CommandName = "Edit" Then |
| e.Item.Edit = True |
| e.Item.OwnerTableView.Rebind() |
| For i As Integer = 0 To e.Item.Controls.Count - 1 |
| val = e.Item.Controls(i) |
| val = e.Item.Controls(i).ID |
| e.Item.Controls(i).......... several try outs without sucess |
| Next |
| End If |
| End Sub |
But nothing seems to work...
Please help