Disable editors within Gridpanel

  1. #1

    Disable editors within Gridpanel

    Hi,

    I am trying to disable the <editor> within a gridpanel column. I tried lot of different options, making combobox in gridpanel (enabled=false), but the editor is still enabled when i click on editable gridpanel.

    How do i disable editors in gridpanel?

    Regards,
    Chintan
  2. #2

    RE: Disable editors within Gridpanel

    Hi,

    You should handle BeforeEdit event of the GridPanel and return false to prevent editing
    beforeedit : ( <code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console', 'Courier New', Courier, monospace; font-size: 12px; ">Object e</code> )<div class="mdesc" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 0px; padding-bottom: 5px; padding-left: 0px; color: rgb(68, 68, 68); "><div class="long" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; display: block; line-height: 18px; ">Fires before cell editing is triggered. The edit event object has the following properties
    <ul style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 16px; list-style-type: none; list-style-position: initial; list-style-image: initial; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">grid - This grid<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">record - The record being edited<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">field - The field name being edited<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">value - The value for the field being edited.<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">row - The grid row index<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">column - The grid column index<li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">cancel - Set this to true to cancel the edit or return false from your handler.[/list]<div class="mdetail-params" style="margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 12px; font-size: 12px; "><strong style="font-style: normal; font-weight: normal; display: block; margin-bottom: 3px; font-size: 11px; color: rgb(85, 85, 85); ">Listeners will be called with the following arguments:[/b]<ul style="margin-top: 12px; margin-right: 12px; margin-bottom: 12px; margin-left: 12px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-type: circle; list-style-position: inside; list-style-image: initial; "><li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; list-style-position: inside; list-style-type: circle; list-style-image: initial; "><code style="font-style: normal; font-weight: normal; font-family: 'Lucida Console', 'Courier New', Courier, monospace; font-size: 12px; ">e</code> : Object<div class="sub-desc" style="margin-top: 5px; margin-right: 5px; margin-bottom: 5px; margin-left: 16px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; ">An edit event (see above for description)[/list]



  3. #3

    RE: Disable editors within Gridpanel

    I've the same problem, but I must verify the user's credential (Admin or guest) for enable or not the editing.So I must write code in .cs file.I can use the "BeforeEdit" in aspx page? If yes, how?


    You have any idea?


    Thank's
  4. #4

    RE: Disable editors within Gridpanel

    I've try to use the follow code


    
    <AjaxEvents>
            <BeforeEdit OnEvent="gpSurvey_BeforeEdit" />
      </AjaxEvents>
    
    
    
    
    
    
    protected void gpSurvey_BeforeEdit(object sender, AjaxEventArgs e)
            {
                if (HttpContext.Current.Session["UserLoggedName"] != "admin")
                {
                    e.Success = false;
                }
            }

    but in this mode, the user recive an error. I'd like have like "e.cancel"....


    any idea?


Similar Threads

  1. [CLOSED] RowExpander and GridPanel with editors: how to?
    By capecod in forum 1.x Legacy Premium Help
    Replies: 25
    Last Post: Nov 03, 2010, 11:15 AM
  2. Replies: 2
    Last Post: Aug 04, 2010, 2:26 AM
  3. Replies: 4
    Last Post: Jun 02, 2010, 12:14 PM
  4. Multiple Editors for
    By r_honey in forum 1.x Help
    Replies: 2
    Last Post: Jun 18, 2009, 2:27 AM
  5. If Value = X Then Disable Grid Editors...?
    By Tbaseflug in forum 1.x Help
    Replies: 4
    Last Post: Jun 11, 2009, 3:06 PM

Posting Permissions