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
70
How to Add Dynamic Checkbox column in ig:WebHierarchicalDataGrid
posted

Hi 

I am working on a ASP.NET project.I am new to Infragistics.

I have a requirement to add check box column dynamically. I have 3 fixed columns those are BoundFields.

My Requirement is,

After bunding 3 fixed columns I have to add checkbox column dynamically in the code behind and need to bind value based on value getting from the database.

or 

Please suggests me any other best option. Please find grid view screenshot and code.

Please provide me some sample code  would be appreciable    

Design View:

I need to make column dynamic marked in red. Currently these columns are static. I need to make all checkbox column dynamically binding 

Code

 <ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid" runat="server" Width="100%" AutoGenerateBands="true"
                                AutoGenerateColumns="false" DataKeyFields="IQuestionId" EnableDataViewState="true" CollapseButton-ImageUrl="~/images/colapseMinus.png" 
                                CollapseButton-HoverImageUrl="~/images/colapseMinus.png" CollapseButton-PressedImageUrl="~/images/colapseMinus.png"
                                ExpandButton-ImageUrl="~/images/expandPlus.png" ExpandButton-HoverImageUrl="~/images/expandPlus.png" 
                                ExpandButton-PressedImageUrl="~/images/expandPlus.png"
                                CssClass="headerRow" GroupingSettings-GroupedBandCssClass="headerRow">

                                <Behaviors>
                                    <ig:Selection Enabled="false" CellClickAction="Row" RowSelectType="None">
                                    </ig:Selection>
                                </Behaviors>

                                <GroupingSettings EnableColumnGrouping="True" GroupAreaVisibility="Visible" InitialRowExpandState="Collapsed" />

                                <Columns>
                                    <ig:BoundDataField DataFieldName="IQuestionId" Width="0%" Key="IQuestionId" Hidden="true" Header-Text="" />
                                    <ig:BoundDataField DataFieldName="VchQuestionText" Width="30%" Key="VchQuestionText" Hidden="false" Header-Text="Question Text" />
                                    <ig:BoundDataField DataFieldName="VchSectionName" Width="0%" Key="VchSectionName" Hidden="true" Header-Text="Section Name" />
                                    <ig:BoundDataField DataFieldName="VchQuestionType" Width="15%" Key="VchQuestionType" Hidden="false" Header-Text="Question Type" />
                                    <ig:BoundDataField DataFieldName="VchAnswerType" Width="15%" Key="VchAnswerType" Hidden="false" Header-Text="Answer Type" />

                                    <ig:TemplateDataField Key="TempMedical" Header-Text="MedicalTest" Width="8%">
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkMedical" runat="server"
                                                Checked='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Medical") %>' />
                                        </ItemTemplate>
                                    </ig:TemplateDataField>

                                    <ig:TemplateDataField Key="TempAviation" Header-Text="AviationTest" Width="8%">
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkAviation" runat="server"
                                                Checked='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Aviation") %>' />
                                        </ItemTemplate>
                                    </ig:TemplateDataField>

                                    <ig:TemplateDataField Key="TemSecurity" Header-Text="Security" Width="8%">
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkISecurity" runat="server"
                                                Checked='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "ISecurity") %>' />
                                        </ItemTemplate>
                                    </ig:TemplateDataField>

                                    <ig:TemplateDataField Key="TemTechinical" Header-Text="Techinical" Width="8%">
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkTechinical" runat="server"
                                                Checked='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Techinical") %>' />
                                        </ItemTemplate>
                                    </ig:TemplateDataField>

                                    <ig:TemplateDataField Key="TemLogistics" Header-Text="Logistics" Width="8%">
                                        <ItemTemplate>
                                            <asp:CheckBox ID="chkLogistics" runat="server"
                                                Checked='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "Logistics") %>' />
                                        </ItemTemplate>
                                    </ig:TemplateDataField>

                                </Columns>


                            </ig:WebHierarchicalDataGrid>

Thanks in Advance 

Pughal

  • 1080
    Offline posted

    Hello,

    Thank you for posting in our community.

    I noticed that the same question is asked in another forum thread. According to our support policy, we handle single post per query in order to ensure that your issue is addressed and tracked correctly.

    Having this in mind, I will continue assisting you via the other thread.

    Thank you for using Infragistics components.