Click here to Skip to main content
15,867,834 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm trying to create an anchor which uses bootstrap, specifically the data-toggle=tab attribute and the anchor also has onServerClick Event which creates dynamic tables to be displayed inside the specified tab. Here are my lines of codes:

For HTML:
ASP.NET
<a href="#Lenses" data-toggle="tab"  runat="server" id="Anc_Lenses" >Lenses</a>

Code Behind:
C#
protected void Anc_Lenses_ServerClick(object sender, EventArgs e)
        {
            string sqlQuery_Frames = @"select    inventoryID,image,name,price,quantityLeft from Cont_Lenses";
            CreateTable(sqlQuery_Frames);
        }

But due to some unknown reason (probably my fault) it just doesn't work. I'm figuring that the problem is bootstrap attributes cannot be used together with control events. Is there any way I can fix this just by using the code behind and not by jQuery?
Posted
Comments
TheRealSteveJudge 4-Dec-14 3:19am    
What do yo expect?
What does not work?
I am not a clairvoyant...
Member 11270913 4-Dec-14 3:40am    
I'm expecting that once I clicked the anchor it will redirect me to the specified tab which in this case is the #Lenses and once I'm in that tab it will create the table. I tried using breakpoints in the click events but it is not firing the event.

1 solution

OnClick="Anc_Lenses_ServerClick" is needed to handle the click event in code behind.

ASP.NET
<a href="#Lenses" data-toggle="tab" runat="server" id="Anc_Lenses" onclick="Anc_Lenses_ServerClick">Lenses</a>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900