locked
PopOver RRS feed

  • Question

  • User-1499457942 posted

    Hi

      I have below code. I want if Value = "" or null in that Gridview row column Location then popover should not work

    $(document).ready(function () {
                $('.popovers').popover();
            });
    
    <asp:TemplateField HeaderText="Group">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lblLocation" Text='<%#Eval("Location") %>'
                                        CssClass="popovers" data-trigger="hover" data-placement="bottom" title="Title here"  data-content='<%# string.Format("Emp Code :<i>{0}</i> </i>", Eval("Employee") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>

    Thanks

    Monday, November 26, 2018 5:02 AM

All replies

  • User61956409 posted

    Hi JagjitSingh,

    I want if Value = "" or null in that Gridview row column Location then popover should not work

    If the value of Employee field is "" or null, the label would be rendered as below.

    You could try to use jQuery Attribute Not Equal Selector to achieve the requirement.

     $('.popovers[data-content!="Emp Code :<i></i>"]').popover();

    With Regards,

    Fei Han

    Tuesday, November 27, 2018 6:01 AM
  • User-1499457942 posted

    HI

      Cant it is possible that Popover should not appear in case of Null or ""

    Thanks

    Tuesday, November 27, 2018 9:29 AM
  • User61956409 posted

    Hi JagjitSingh,

    Do you try the solution that I shared? Does it not work for you?

    Test Result:

    the value of Employee field is "" in the second row, it does not display Popover.

    JagjitSingh

    Cant it is possible that Popover should not appear in case of Null or ""

    Please share the screenshot of html markup of Label "lblLocation" as I did in my previous reply. 

    With Regards,

    Fei Han

    Tuesday, November 27, 2018 9:33 AM
  • User-1499457942 posted

    Hi Fei Han

      I am trying like this but it is saying ) required . Secondly i want to display 2 - 3 fields in separate lines

    <asp:Label runat="server" ID="lblLocation" Text='<%#Eval("Location") %>' CssClass="popovers"
    data-content='<%# string.Format("Emp Code :<i>{0}</i> </i>", Eval("Employee") %>' data-placement="top" data-trigger="hover"></asp:Label>

    <script type="text/javascript" charset="utf-8">
            $(document).ready(function () {
    
                $('.popovers').popover();
            });
    
        </script>

    Thanks

    Thursday, December 13, 2018 7:37 AM