1
Answer

Unable to apply CSS class to listview

sonal thosar

sonal thosar

13y
2.7k
1
Hi Everyone,

I have listview in my webform. I am trying to apply css class to my listview bt it doesnt effect on my listview....plz help me


<style type="text/css">
table.example { }
table.example th { }
table.example td { background-color: #FFFFFF; }
table.example tr.a td { background-color: #808080; } /* Alternating rows */
</style>

<asp:ListView ID="lstDoc" runat="server" DataKeyNames="PublishDate,LinkType"
                              onitemcommand="lstDoc_ItemCommand" onitemdatabound="lstDoc_ItemDataBound">
                              <LayoutTemplate>
                                    <tr id="itemplaceholder" runat="server">
                                    </tr>
                                </LayoutTemplate>
                                <ItemTemplate>
                              
                                <%--<tr id="trDate" runat="server" visible="false">
                                    </tr>--%>
                                    <%--<tr>--%>
                                    <tr class="<%# Container.DisplayIndex % 2 == 0 ? "" : "a" %>">
                                        <td style="padding: 8px;">
                                            <asp:Label ID="lblCoName" runat="server" Text='<%#Eval("CoName") %>'></asp:Label>&nbsp;&nbsp;<b>:</b>&nbsp;&nbsp;
                                            <asp:HyperLink ID="hpCompanyName" runat="server"  NavigateUrl='<%#String.Format("CompanyEventList.aspx?CC={0}",Eval("CoCode")) %>'  Text='<%#Eval("Name") %>'></asp:HyperLink>
                                           
                                                <img id="imgdocflag" runat="server" visible="false" /></span>
                                         
                                        </td>
                                        <td>
                                           
                                            <asp:LinkButton ID="lbPDf" runat="server" CausesValidation="false" ><img id="imgPdf" style="cursor: pointer" runat="server" /></asp:LinkButton>
                                                                                     
                                            <asp:HiddenField ID="hdnPdf" runat="server" Value='<%#Eval("FileName") %>' />
                                            <asp:HiddenField ID="hdnCoCode" runat="server"  Value='<%#Eval("CoCode") %>'/>
                                            <asp:HiddenField ID="hdnConame12" runat="server"  Value='<%#Eval("CoName") %>'/>
                                            <asp:HiddenField ID="hdnUserTypeID" runat="server"  Value='<%#Eval("UserTypeID") %>'/>
                                            <asp:HiddenField ID="hdnStatus" runat="server"  Value='<%#Eval("Status") %>'/>
                                            <asp:HiddenField ID="hdnAnonymous" runat="server"  Value='<%#Eval("IsAnonymous") %>'/>
                                           <asp:HiddenField ID="hdnAnalystName" runat="server"  Value='<%#Eval("AnalystName") %>'/>
                                           
                                         </td>
                                    </tr>
                                </ItemTemplate>
                            </asp:ListView>


Thank u
                       
Answers (1)