Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
WebDataGrid, TemplateField Checkbox, using JavaScript
posted

Hi,

Im trying to retrieve the value of a checkbox that is inside of a template field using JavaScript on the following WebDataGrid:

<ig:WebDataGrid ID="dataGridBrands" runat="server" Height="350px" Width="100%" 

                                            AutoGenerateColumns="False" 

                                            StyleSetName="Office2007Blue">

                                            <EditorProviders>

                                                <ig:DropDownProvider ID="wdg_DiscountType">

                                                    <EditorControl DropDownContainerMaxHeight="200px" EnableAnimations="False" EnableDropDownAsChild="False">

                                                        <Button AltText="" />

                                                        <Items>

                                                            <ig:DropDownItem Selected="False" Text="None" ToolTip="None" Value="1">

                                                            </ig:DropDownItem>

                                                            <ig:DropDownItem Selected="False" Text="Percent" ToolTip="Percent" Value="2">

                                                            </ig:DropDownItem>

                                                            <ig:DropDownItem Selected="False" Text="Value" ToolTip="Value" Value="3">

                                                            </ig:DropDownItem>

                                                        </Items>

                                                    </EditorControl>

                                                </ig:DropDownProvider>

                                                <ig:NumericEditorProvider ID="wdg_Discount">

                                                    <EditorControl MinDecimalPlaces="2" NullValue="0" ValueText="0.00" 

                                                        MaxDecimalPlaces="2" MaxLength="5" MinValue="0" Nullable="False" 

                                                        NullText="0.00">

                                                    </EditorControl>

                                                </ig:NumericEditorProvider>

                                            </EditorProviders>

                                            <Columns>

                                                <ig:BoundDataField DataFieldName="Description" Key="Description" Width="180px">

                                                    <Header Text="Service" />

                                                </ig:BoundDataField>

                                                <ig:BoundDataField DataFieldName="IdDiscountType" Key="IdDiscountType" 

                                                    Width="160px">

                                                    <Header Text="Discount Type" />

                                                </ig:BoundDataField>

                                                <ig:BoundDataField Key="Discount" DataFieldName="Discount">

                                                    <Header Text="Discount Value" />

                                                </ig:BoundDataField>

                                                <ig:TemplateDataField Key="IsEnabled">

                                                    <ItemTemplate>

                                                        <asp:CheckBox ID="chkEnabled" runat="server" 

                                                            Checked='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "IsEnabled") %>' />

                                                    </ItemTemplate>

                                                    <Header Text="Enabled" />

                                                </ig:TemplateDataField>

                                                <ig:BoundDataField Key="IdCarrier" DataFieldName="IdCarrier" Hidden="True">

                                                    <Header Text="IdCompanyCarrier" />

                                                </ig:BoundDataField>

                                                <ig:BoundDataField Key="IdCompanyCarrier" DataFieldName="IdCompanyCarrier" 

                                                    Hidden="True">

                                                    <Header Text="IdCarrier" />

                                                </ig:BoundDataField>

                                            </Columns>

                                            <Behaviors>

                                                <ig:EditingCore AutoCRUD="False">

                                                    <Behaviors>

                                                        <ig:CellEditing Enabled="true">

                                                            <ColumnSettings>

                                                                <ig:EditingColumnSetting ColumnKey="Description" ReadOnly="True" />

                                                                <ig:EditingColumnSetting EditorID="wdg_Discount" ColumnKey="Discount" />

                                                                <ig:EditingColumnSetting ColumnKey="IdDiscountType" 

                                                                    EditorID="wdg_DiscountType" />

                                                                <ig:EditingColumnSetting ColumnKey="IsEnabled" />

                                                                <ig:EditingColumnSetting />

                                                            </ColumnSettings>

                                                            <EditModeActions MouseClick="Single" />

                                                        </ig:CellEditing>

                                                    </Behaviors>

                                                </ig:EditingCore>

                                                <ig:Paging PageSize="10" PagerAppearance="Bottom" />

                                            </Behaviors>

                                            <EmptyRowsTemplate>

                                               No data to show

                                            </EmptyRowsTemplate>

                                        </ig:WebDataGrid>

 

I iterate thru the elements with the follwing JS:

                 var grid = $find("<%= dataGridBrands.ClientID %>");

                 var lst = document.getElementById("<%= lstProducts.ClientID %>");

                 lst.options.length = 0;

                for (var i = 0; i < grid.get_rows().get_length(); i++) {

                 var row = grid.get_rows().get_row(i);

                 if (row.get_cell(3).get_value() == "true") {  // <- here fails

                     lst.add(new Option(row.get_cell(3).get_value(),row.get_cell(3).get_value()));

                 }

                }

        That get_value() returns the whole INPUT tag but not the checkbox one... so ok, look at the attachment, i cannot even get the id with the method, but if i select manually the element by the reported Id from the get_value() method, it "works".

Please help me to solve it, i have allready 3 days workin on the same thing and its frustrating

thanks