We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

GridRowEditUpdateLink disabled status

Thread ID:

Created:

Updated:

Platform:

Replies:

92187 Dec 27,2009 09:56 AM Jan 4,2010 10:24 AM ASP.NET Web Forms (Classic) 1
loading
Tags: GridGroupingControl
Maurizio Selvaggini
Asked On December 27, 2009 09:56 AM

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

Jaffersathick B [Syncfusion]
Replied On January 4, 2010 10:24 AM

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.

Let me know if you have any concerns.

Regards,
Jaffer. B

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;