0

I have a grid from obout:

<cc1:Grid ID="GridEvalEmp" runat="server" AllowPageSizeSelection="False" AllowPaging="True" PageSize="10"
                                AutoGenerateColumns="False" FolderStyle="styles/style_8" Language="es"
                                Width="600" AllowFiltering="false">
                                 <ClientSideEvents OnClientCallbackError="onGridErrorEval" OnClientAdd="onAddEvalEmp" OnClientEdit="onEditEvalEmp"
                                           OnBeforeClientInsert="validarFechas" OnBeforeClientUpdate="validarFechas"/>
                            <Columns>
                                <cc1:Column ID="ClmCodEval" DataField="codEvaluacion" HeaderText="Capacitación" Visible="false" Index="0" />
                                <cc1:Column ID="ClmNombreCapacitacion" Width="300" HeaderText="Capacitación" DataField="nombreEvaluacion" Index="1" Visible="true" Wrap="True" />
                                <cc1:Column ID="ClmFechaActEval" Width="180" HeaderText="Fecha de Evaluación" DataFormatString="{0:dd/MM/yyyy}" DataField="fechaEvaluacion" Index="2" Visible="true" Wrap="True" />
                                <cc1:Column ID="ClmPuntaje" Width="200"  HeaderText="Puntaje" DataField="puntajeEval" Index="3" Visible="true" Wrap="True" />
                                <cc1:Column ID="ClmEditCap" Width="160" AllowDelete="false" AllowEdit="true" HeaderText="" Index="3" />
                            </Columns>                             
                        </cc1:Grid>                           

I want to disable the ClmPuntaje column on client add. For that I have a javascript function but it doesn't work:

function onAddEvalEmp(record) {
            document.getElementById('ClmPuntaje').disabled = true;
        }

How can I make this work?

Thanks! Sabrina

sabri128
  • 91
  • 1
  • 2
  • 7

3 Answers3

1

Acutally, the Id is not 'ClmPuntaje' when you try to view the souce code for the page. You might get the real Id then the javascript would work. Disabling the whole column is simple via jquery,

<cc1:Column ID="ClmEditCap" Width="160" AllowDelete="false" AllowEdit="true" HeaderText="" CssClass="Class1" Index="3" />

Then, try: $(".Class1")" to identify the elements you want to disable.

Will Hu
  • 149
  • 2
  • 15
  • Thanks for your answer but the CssClass="Class1" is not admited in these columns. It says that it is not a valid attribute. Do you know another way to achive this? – sabri128 Apr 21 '15 at 03:31
  • gridview mechanism provide this behavior without any need to script at all. Now it is up to you to choose the way that suits the best. – MacKentoch Apr 21 '15 at 03:32
0

obout gridview (not standard gridview)

specify a template when adding row (obout site):

<obout:Grid id="grid1" runat="server" RowEditTemplateId="tplRowEdit">
    <Templates>
        <obout:GridTemplate ID="tplRowEdit">
            <Template> 
                ...
            </Template>
        </obout:GridTemplate>
    </Templates>
</obout:Grid>
Community
  • 1
  • 1
MacKentoch
  • 2,346
  • 3
  • 14
  • 19
0

you can use the obout client side Api:

GridEvalEmp.hideColumn("ClmPuntaje");

see the example here: http://www.obout.com/grid/grid_columns_show_hide_columns.aspx

enricoariel
  • 483
  • 2
  • 10