PUNEET BISHT

PUNEET BISHT

  • NA
  • 12
  • 12.8k

jquery and asp.net button click problem

Sep 18 2012 5:24 AM
I am using jquery tabs in asp.net web page. like this-

<ul class="tabs">
                            <li id="tab1"  class="active"></li>
                            <li id="tab2">tab2</li>
                            <li id="tab3">tab3</li>
                        </ul>
                            <span class="clear"></span>
                            <div class="content tab1">
                                <asp:Repeater ID="Repeater_one_way" runat="server">  .... some code.............. </asp:Repeater> </div>


i have a asp.net button control in which clientclickevent() i am validating some text boxes and giving tab title like this   $("#tab1").text(" test title");
tab contain a repeater control.

 <asp:Button ID="btn_find" runat="server" Text="Go"  OnClientClick="if (!enable_tabs()) {return false;}"   onclick="btn_find_trains_Click" /> 


<script type="text/javascript">
       function enable_tabs() {
           var from = document.getElementById('<%=txt_from_station.ClientID%>').value;
           var to = document.getElementById('<%=txt_to_station.ClientID%>').value;

           $("#tab1").text(from + " - " + to);
           $("#btn_finds_Click").click(function(e) { e.preventDefault(); });
         
           if (from == to) {
               alert("from and to stations can not be same!");
               document.getElementById('<%=txt_to_station.ClientID%>').value = "";
               return false;
           }
           else {
               return true;
           }
    }    
   </script>

when i click on the button initially tabs show the title but when the data binds in repeater control , title dissappears,

i tried update panel but nothing happens.

Any suggestions

Answers (3)