DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4
  1. #1
    Michael Guest

    Datagrid question


    I want to use the select event of the datagrid to check if a user has
    rights to edit the row, if the do I want to enable the rows edit button.

    I am doing it in J#, but any example will do!


  2. #2
    John Butler Guest

    Re: Datagrid question

    "Michael" <mrwassermann@netscape.net> wrote in message
    > Hello,
    > I want to use the select event of the datagrid to check if a user has
    > rights to edit the row, if the do I want to enable the rows edit button.
    > I am doing it in J#, but any example will do!

    What rights? Database permissions? If so, you'd check this (call a stored
    procedure which checks their permissions or something) and exit the event if
    they aren't enabled or something.

    What database you using? more info required...

  3. #3
    Zack Guest

    Re: Datagrid question

    It appears my question was not clear, so I will try and redefine it.

    What I have is a DataGrid at shows some data. Everyone can view the data,
    but not everyone can edit it. Since the user must have logged in to get to
    this form, I know their credentials allready. So when the user arives at
    this page the first thing they do is fill in some search criteria (to limit
    the result set). Then the click a btn and the DataGrid is loaded.

    At this point, things get interesting ( Maybe this can't be done ) each
    row has a select btn. When the user ( A Sequence Diagram is in order! )
    clicks the select button so information is pulled from some hidden columns,
    and if the user has the rights to edit (From their profile I have on them
    already) I want to enable the edit and delete buttons.

    The problem seems to be the order in which the grid events work. Their
    are some Rules that apply so not every row can be edited ( Sometimes it needs
    an approval before it can be edited. Security is a big deal in this project.

    So if everyone is on the same page, what is needed is the ability to dynamically
    determine if a row can be edited. Sounds easy but its is
    tricker than I thought.


  4. #4
    John Butler Guest

    Re: Datagrid question

    Zack, have a look at the following sample code, paying particular attention
    to the edit event. Then let me know why this doesn't work for you???
    (pasting the code has stripped the formatting...)

    The code below presumes there is a visible "Edit" link on the grid. If you
    really don't want to show that, you could still trap a select event and put
    the grid into edit mode if they are allowed...Is this where you're having
    the problem???

    John Butler


    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
    System.EventArgs) Handles MyBase.Load

    If Not IsPostBack Then


    End If

    End Sub

    Sub BindGrid()

    DataGrid1.DataSource = mySQLDataSet


    End Sub

    Sub DataGrid1_Edit(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.DataGridCommandEventArgs) Handles

    'Do rules checks here, to make sure this row is editable and the user is
    permissioned to do so..

    If userPermissioned then

    DataGrid1.EditItemIndex = e.Item.ItemIndex



    ' ignore the edit or put up some sort of message that they're not allowed

    DataGrid1.EditItemIndex = -1


    end if

    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.