4

I am having trouble in applying my external CSS on asp:LinkButton tag. When Css is applied on simple button tag it works fine in case of asp:LinkButton tag its not working. Need Help!

enter image description here

 <form id="form1" runat="server">
        <div class="wrapper"> <div class="input-group">
                            <input type="text" name="q" class="form-control" placeholder="Search..." />
                            <span class="input-group-btn">
                                <button type='submit' name='search' id='search-btn' class="btn btn-flat"><i class="fa fa-search"></i></button>
                            </span>
                            <span class="input-group-btn">
                                <asp:LinkButton  runat="server" id="LinkButton1" CssClass="btn btn-flat"><i class="fa fa-search"></i></asp:LinkButton>
                            </span>
                        </div>
                      </div>
                    </form>
Mikaal Anwar
  • 1,720
  • 10
  • 21
EmmyAyes
  • 138
  • 1
  • 12

1 Answers1

3

I believe the CSS change isn't reflecting in your asp:LinkButton because an asp:LinkButton generates a hyperlink <a>...</a> while in the other span element above you are using a button <button></button> which are not equivalent. Try using something like <asp:Button ...> instead of a <asp:LinkButton ...> and see if the problem persists.

Mikaal Anwar
  • 1,720
  • 10
  • 21
  • Initially, I tried using but it gives error "the element ' i ' cannot be nested within element button." – EmmyAyes May 19 '18 at 03:36
  • In that case you may just use a normal HTML – Mikaal Anwar May 19 '18 at 03:46
  • Thank you so much. problem resolved but I have another confusion yet. How can I add functionality i.e. connection to database/ c# function call on that html button. any referral link. I tried finding but could get any relevant to my problem – EmmyAyes May 19 '18 at 04:02
  • Please see the attached link on how to manage database connectivity: https://www.codeproject.com/Tips/1038536/Day-Database-Connectivity-ASP-NET-Csharp-with-SQL Its the bare minimum you need to know if you're starting out. However, I would strongly recommend you to follow a 3-tier architecture for better software design. Something like this: http://www.dotnetfunda.com/articles/show/71/3-tier-architecture-in-aspnet-with-csharp P.S Don't forget to upvote. Thanks! – Mikaal Anwar May 19 '18 at 04:48