'Could anybody plesae tell me , how can I add a new row to this table using VB code ?
'dgPeripherals.AllowAddNewRow = True
'dgPeripherals.Rows.Insert(0, dgPeripherals.Rows.NewRow())
'dgPeripherals.Refresh()
'But it does display me a new row insert recrods to the grid.
'I have added above code inside the hander event of the Add button as follows ,
Imports
Telerik.WinControls.UI
Imports
Telerik.WinControls.UI.GridViewColumn
Private
Sub
FormTeleic_Load(sender
As
Object
, e
As
EventArgs)
Me
.dgPeripherals =
New
Telerik.WinControls.UI.RadGridView()
GeneratePeripheralsGridColumns()
End
Sub
Private
Sub
dgPeripherals_CommandCellClick(sender
As
Object
, e
As
EventArgs)
Dim
gCommand
As
GridCommandCellElement = TryCast(sender, GridCommandCellElement)
Dim
result
As
DialogResult
If
gCommand.ColumnInfo.Name =
"clmAdd"
Then
dgPeripherals.AllowAddNewRow =
True
dgPeripherals.Rows.Insert(0, dgPeripherals.Rows.NewRow())
dgPeripherals.Refresh()
End
If
End
Sub
Private
Sub
GeneratePeripheralsGridColumns()
' TEXT COLUMN
Dim
clmItemSN
As
New
GridViewTextBoxColumn()
clmItemSN.HeaderText =
"Item S/N"
clmItemSN.Width = 100
Dim
clmItemName
As
New
GridViewTextBoxColumn()
clmItemName.HeaderText =
"Item Name"
clmItemName.Width = 100
Dim
clmAdd
As
New
GridViewCommandColumn()
clmAdd.Name =
"clmAdd"
clmAdd.UseDefaultText =
True
clmAdd.DefaultText =
"Add"
clmAdd.HeaderText =
"Add"
dgPeripherals.Columns.Add(clmItemSN)
dgPeripherals.Columns.Add(clmItemName)
dgPeripherals.Columns.Add(clmAdd)
End
Sub
' What I want is to add a new row to the excisting grid when clicked on the Add Button on the previous row
'The default behaviour is , it adds a new row to the grid when I press enter on the last text cell , but I want this to happend upon add button click event.
'Is this possible to achive with Teleric Grids ? Can somebody help me please ?
'I'm new to teleric grid , please bear with me if I missed anything,
'Thanks in advance.