Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > Pro VB 6
|
Pro VB 6 For advanced Visual Basic coders working in version 6 (not .NET). Beginning-level questions will be redirected to other forums, including Beginning VB 6.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Pro VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 13th, 2005, 10:54 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 121
Thanks: 1
Thanked 0 Times in 0 Posts
Default How to disable the SELECT DataGrid button

Hello,
Is there any way programmatically to disable the SELECT button inside the ASP.NET DataGrid column for particular record based on specific select conditions?
Thanks in advance
-Dmitriy
 
Old June 29th, 2005, 07:03 AM
Friend of Wrox
 
Join Date: Jul 2003
Posts: 121
Thanks: 1
Thanked 0 Times in 0 Posts
Default

Hello again,
I figured out how to do this. I've used ItemDataBound() method of the datagrid control. I am using CheckConditions() home-made function to check any conditions I want, and after that I am using returned value to Enable/Disable the button in the first cell e.Item.Cells(0).

Example:

Private Sub grdSelect_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataGridItemEventArgs) Handles grdSelect.ItemDataBound
        Dim sXYZ_Parameter As String
        Dim bReturn As Boolean

        If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Or e.Item.ItemType = ListItemType.SelectedItem Then

            sXYZ_Parameter = "Place here any parameter to check for.."
            bReturn = CheckConditions(sXYZ_Parameter)
            If bReturn = False Then
                'btn.Enabled = False
                e.Item.Cells(0).Enabled = False
            Else
                'btn.Enabled = True
                e.Item.Cells(0).Enabled = True
            End If
        End If
    End Sub

Hope it will help to someboby
-Dmitriy:)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Disable a button sansircar ASP.NET 1.0 and 1.1 Professional 6 January 12th, 2007 09:38 AM
Select Button on a DataGrid Ric_H ADO.NET 1 March 23rd, 2006 06:33 PM
Select Button on a DataGrid Ric_H General .NET 0 March 22nd, 2006 04:16 PM
Select Button on a DataGrid Ric_H C# 0 March 22nd, 2006 04:14 PM
disable Select option Dj Kat HTML Code Clinic 2 March 10th, 2006 04:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.