asp.net How to disable the "Edit and delete function" in "EditCommandColumn"

Discussion in 'C#' started by alanX, Jul 26, 2006.

  1. #1
    Hi all;
    in the "DataGrid1", Here are two function "Edit" and "delete". But I don't want those functions to be visible to unauthorized people. So in the "Page_Load" function,I will check user's accessing right
     
    alanX, Jul 26, 2006 IP
  2. whiteshark

    whiteshark Peon

    Messages:
    58
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #2
    When the page loads, why don't you just set the properties of those objects to "visible = false"?
     
    whiteshark, Jul 27, 2006 IP
  3. alanX

    alanX Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3

    Thank you for your reply,

    Could you expain it more deeply,we can not set ID in the "<asp:EditCommandColumn />" and "<asp:ButtonColumn />",

    how can i make those object " UnknownID.Visible = false" in the Page_load?

    Pl:confused: Z help me
     
    alanX, Jul 27, 2006 IP
  4. benjymouse

    benjymouse Peon

    Messages:
    39
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Find the ordinal position of the column and use this to access the column object:

    DataGrid1.Columns[0].Visible = false;
     
    benjymouse, Jul 28, 2006 IP
  5. alanX

    alanX Peon

    Messages:
    61
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    yes,So great, The problem is completely solved.

    thanks a lot
     
    alanX, Jul 28, 2006 IP