sabri128
sabri128

Reputation: 141

Obout Grid Asp.Net disable text column on adding

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

Upvotes: 0

Views: 674

Answers (3)

enricoariel
enricoariel

Reputation: 483

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

Upvotes: 0

MacKentoch
MacKentoch

Reputation: 2446

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>

Upvotes: 0

Will Hu
Will Hu

Reputation: 169

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.

Upvotes: 1

Related Questions