Results 1 to 5 of 5

Thread: [Resolved] Set datagrid cell enabled to false

Threaded View

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Oct 2001
    Location
    Indiana
    Posts
    612

    Resolved [Resolved] Set datagrid cell enabled to false

    When a user hits the edit button, I want to either make a certain cell not enabled, or not visible. I don't care which. I can't seem to get either to work.

    Here is my code that I tried:
    VB Code:
    1. Dim cn As New OleDb.OleDbConnection("Provider=SQLOLEDB.1;Integrated Security=SSPI;" _
    2.                                  & "Persist Security Info=False;" _
    3.                                  & "Initial Catalog=fuel info;" _
    4.                                  & "UID=;PWD=;" _
    5.                                  & "Data Source=Server7")
    6.         cn.Open()
    7.  
    8.         Dim datAdapt As New OleDb.OleDbDataAdapter("Select Vendor_No as [Vendor No], " & _
    9.         "Vendor_Name as [Vendor Name], Vendor_Terminal as [Vendor Terminal], " & _
    10.         "Vendor_Trmnl_No As [Terminal No], Vendor_City As [City], Vendor_State As " & _
    11.         "[State], ID From Other_Vendors Order By Vendor_Name", cn)
    12.  
    13.         Dim datSet As New Data.DataSet
    14.  
    15.         datAdapt.Fill(datSet, "Other_Vendors")
    16.  
    17.         DataGrid1.DataSource = datSet
    18.         DataGrid1.DataKeyField = "ID"
    19.         DataGrid1.EditItemIndex = e.Item.ItemIndex
    20.         e.Item.Cells(3).Enabled = False
    21.         DataGrid1.DataBind()
    22.         cn.Close()
    23.         cn.Dispose()
    24.         datAdapt.Dispose()
    25.         datSet.Dispose()
    As you can see, the line that is not working is "e.item.cells(3).enabled = false"

    Also, if anyone knows how to set the width of the cell on the fly as well, I would appreciate that as well.

    Thanks
    Last edited by indydavid32; Oct 25th, 2004 at 11:51 AM.
    David Wilhelm

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width