The Syncfusion native Blazor components library offers 70+ UI and Data Viz web controls that are responsive and lightweight for building modern web apps.
.NET PDF framework is a high-performance and comprehensive library used to create, read, merge, split, secure, edit, view, and review PDF files in C#/VB.NET.
Hi, first of all, thanks for your previous answers. here is another problem:
setting the Enabled property of a GridRowEditUpdateLink control to False, the GridRowEditUpdateLink appears disabled (grayed) but the delete event is raised anyway with no respect to enabled/disabled status. I think when the control has enabled=False no events have to be raised. Can you confirm this? Below is a description of my contest, if you need more data i can upload it.
My Syncfusion version is 7.203.0.37.
Best regards Maurizio Selvaggini
I have a gridgrouping control with a customized GridRowEditUpdateLink control. I need a customized handler to delete rows because some rows in the grid cannot be deleted while other rows can be. I create each GridRowEditUpdateLink control during the QueryCellStyleInfo event, using ItemTemplate class. During the databind event i enable or disable the GridRowEditUpdateLink controls with respect to a field value in the database.
'---------------------------- ' QUERYCELLSTYLEINFO event '---------------------------- Protected Sub gridPDS_QueryCellStyleInfo(ByVal sender As Object, ByVal e As Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoEventArgs) Handles gridPDS.QueryCellStyleInfo Dim cellx As Syncfusion.Web.UI.WebControls.Grid.Grouping.GridTableCellStyleInfoIdentity cellx = e.Style.Identity If (cellx Is Nothing) Then Exit Sub If (cellx.Column Is Nothing) Then Exit Sub If (e.TableCellIdentity.TableCellType = GridTableCellType.ColumnHeaderCell) Then Exit Sub Select Case cellx.Column.MappingName Case "CustomID" Dim delete_link As New GridRowEditUpdateLink AddHandler delete_link.Click, AddressOf MyDeleteHandler delete_link.ID = cellx.Column.MappingName delete_link.CssClass = "delete" ' to display a client confirm dialog box e.TableCellIdentity.Column.ItemTemplate = New item_template(delete_link) Case "checkbox_field" Dim chk As New CheckBox chk.Enabled = False chk.ID = cellx.Column.MappingName e.TableCellIdentity.Column.ItemTemplate = New item_template(chk) End Select End Sub
Here is the template class:
'---------------------------- ' ITEMTEMPLATE class '---------------------------- Public Class item_template : Implements ITemplate Private m_ctrlChildControl As Control = Nothing Public Sub New(ByVal ctrlChildControl As Control) m_ctrlChildControl = ctrlChildControl End Sub Public Sub InstantiateIn(ByVal container As Control) Implements ITemplate.InstantiateIn AddHandler m_ctrlChildControl.DataBinding, AddressOf bind_control container.Controls.Add(m_ctrlChildControl) End Sub
Here is the bind control sub: (emedded in item_template)
'---------------------------- ' BIND_CONTROL '---------------------------- Public Sub bind_control(ByVal sender As Object, ByVal e As EventArgs) Dim chkbox As CheckBox Dim delete_link As GridRowEditUpdateLink Dim grid_row As GridRow Dim value As Boolean If (sender.GetType() Is GetType(CheckBox)) Then chkbox = CType(sender, CheckBox) grid_row = GetGridRow(chkbox) If (grid_row Is Nothing) Then Return value = grid_row.Record.GetValue(chkbox.ID) chkbox.Checked = value ElseIf (sender.GetType() Is GetType(GridRowEditUpdateLink)) Then delete_link = CType(sender, GridRowEditUpdateLink) grid_row = GetGridRow(delete_link) ' when value is DbNull the row can be deleted If (grid_row.Record.GetValue(delete_link.ID) Is DBNull.Value) Then delete_link.DeleteLinkText = "delete" delete_link.Enabled = True Else delete_link.DeleteLinkText = "no delete" delete_link.Enabled = False End If End If End Sub
Here is the GetGridRow function: (embedded in item_template)
'---------------------------- ' GETGRIDROW '---------------------------- Private Function GetGridRow(ByVal sender As Control) As GridRow Dim upper_object As Object Dim grid_row As GridRow upper_object = sender.Parent While Not (upper_object.GetType Is GetType(GridRow)) upper_object = upper_object.Parent If (upper_object Is Nothing) Then Return Nothing End While grid_row = DirectCast(upper_object, GridRow) Return grid_row End Function End Class
JBJaffersathick B Syncfusion Team January 4, 2010 03:24 PM UTC
Hi Maurizio,
Thanks for your interest in Syncfusion products.
Instead of using the Enabled property of the GridRowEditUpdateLink we suggest you to use the ShowEditLink property as false. So that the link is not shown in the Grid view.