Click here to Skip to main content
15,894,825 members

Comments by amitkumar5734 (Top 46 by date)

amitkumar5734 17-Sep-15 11:27am View    
yes i have added header
<asp:GridView ID="gd1" runat="server" style="margin-left:0px;" BackColor="White" BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" GridLines="None" CellSpacing="1" AutoGenerateColumns="false" OnRowDataBound="gd1_RowDataBound" OnRowCommand="gd1_RowCommand">
<columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkCol1" runat="server" Checked ="true" />
<asp:Label ID="lblCol1" runat="server" Text ="MarketingRequest"/>
</HeaderTemplate>
<itemtemplate>
<asp:Label ID="lbl_mr" runat="server" Text='<%#Eval("MarketingRequest") %>'>



<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkCol2" runat="server" Checked="true" />
<asp:Label ID="lblCol2" runat="server" Text ="ServiceOrder"/>
</HeaderTemplate>
<itemtemplate>
<asp:Label ID="lbl_so" runat="server" Text='<%#Eval("ServiceOrder") %>'>



<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkCol3" runat="server" Checked ="true" />
<asp:Label ID="lblCol3" runat="server" Text = "TicketID"/>
</HeaderTemplate>
<itemtemplate>
<asp:Label ID="lbl_ticketid" runat="server" Text='<%#Eval("TicketID") %>'>




<asp:TemplateField>
<HeaderTemplate>
<asp:CheckBox ID="chkCol4" runat="server" Checked = "true" />
<asp:Label ID="lblCol4" runat="server" Text = "TicketDueDate"/>
</HeaderTemplate>
<itemtemplate>
<asp:Label ID="lbl_duedate" runat="server" Text='<%#Eval("TicketDueDate") %>'>



<asp:TemplateField >
<HeaderTemplate>
<asp:CheckBox ID="chkCol5" runat="server" Checked = "true" />
<asp:Label ID="lblCol5" runat="server" Text = "ServiceName"/>
</HeaderTemplate>
<itemtemplate>
<asp:Label ID="lbl_sn" runat="server" Text='<%#Eval("ServiceName") %>'>




see .
amitkumar5734 17-Sep-15 11:10am View    
hi any answer .
amitkumar5734 17-Sep-15 10:55am View    
actually in my project i have a calendar control and on Calendar1_SelectionChanged event , i am binding my grid view , so on page load when i am trying to call if (IsPostBack) { GetCheckBoxStates();} , throws error "object reference not set to an instance of an object "

here i got error ,

private void GetCheckBoxStates()
{
CheckBox chkCol1 = (CheckBox)gd1.HeaderRow.Cells[0].FindControl("chkCol1");
CheckBox chkCol2 = (CheckBox)gd1.HeaderRow.Cells[0].FindControl("chkCol2");



and i know why this is happing but getting null value but i am not able to solve this where i need to call this function because on selection event my grid view is binding and not able to call my grid view on page load .
amitkumar5734 17-Sep-15 10:30am View    
not working i have tried this one , any other method to select the columns and export .
amitkumar5734 19-May-15 9:09am View    
what is this , do u really think , we have that much time to read out tutorials , if we would have than i think i dont need to put my question here ,