anand m

anand m

  • 1.4k
  • 339
  • 34.6k

how to add dynamic columns header and value last cell in Gridview

Apr 13 2023 11:36 AM

Hello All,

I need to add one dynamic column to gird view control to the last column(email) , this column not exist in DB.

My existing Gridview code here.Please help me to add i am getting that email column value from Other AD code.

UI

<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None" OnRowDataBound="GridView1_RowDataBound">
    <AlternatingRowStyle BackColor="White" />                     
    <FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
    <PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
    <RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
    <SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
    <SortedAscendingCellStyle BackColor="#FDF5AC" />
    <SortedAscendingHeaderStyle BackColor="#4D0000" />
    <SortedDescendingCellStyle BackColor="#FCF6C0" />
    <SortedDescendingHeaderStyle BackColor="#820000" />
    <Columns>
        <asp:TemplateField>  
                <HeaderTemplate>   
                    <asp:CheckBox ID="chkAllSelect" runat="server" onclick="CheckAll(this);" />  
                </HeaderTemplate>  
                <ItemTemplate>  
                    <asp:CheckBox ID="chkSelect" runat="server" />  
                </ItemTemplate>  
            </asp:TemplateField>
                         
    </Columns>
    <Columns>
        <asp:TemplateField>  
                <HeaderTemplate>   
                    <asp:CheckBox ID="chkAllSelect1" runat="server" onclick="CheckAll1(this);" />  
                </HeaderTemplate>  
                <ItemTemplate>  
                    <asp:CheckBox ID="chkSelect1" runat="server" />  
                </ItemTemplate>  
            </asp:TemplateField>
                         
    </Columns>
</asp:GridView>

 


Answers (2)