Click here to Skip to main content
15,895,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a simple drop down and used bootstrap functionality in this but after post back it does not work.
Below is my code Please help me in this.



<head runat="server">
<meta http-equiv="C/>
<title>Hr Software Tool</title>
<meta name="viewport" c/>
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,300italic,400italic,600italic,600,700,800,700italic,800italic' rel='stylesheet' type='text/css' />
<link href="C/>
<link href="C/>
<link href="C/>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="Scripts/js/bootstrap.min.js"></script>
<script type="text/javascript" src="Scripts/js/bootstrap-select.js"></script>
<link rel="stylesheet" type="text/css" href="C>
<style> body {
min-height: 800px;
}
</style>

</script>

</head>
<body class="login-body">
<form id="form1" runat="server">

<asp:ScriptManager ID="tem" runat="server">


<asp:UpdatePanel ID="up" runat="server">
<c>
<asp:DropDownList ID="ddlDropDown" CssClass="selectpicker" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlDropDown_SelectedIndexChanged" >
<asp:ListItem>Wasif
<asp:ListItem>Test
<asp:ListItem>Focus
<asp:ListItem>Lacoste
<asp:ListItem>Levis
<asp:ListItem>Lee
<asp:ListItem>Bullock
<asp:ListItem>Sending


<asp:Label ID="lblRecord" runat="server" Text="Null">

<triggers> <asp:AsyncPostBackTrigger ControlID="ddlDropDown" EventName="SelectedIndexChanged" />


</form>
</body>
Posted
Updated 22-Sep-14 20:53pm
v2

When the UpdatePanel refreshes, it destroys the DOM for those TextBoxes, removing the jQuery event handlers in the process. Use PageLoad() instead of $(document).ready(), and they will be wired back up after every partial postback.
 
Share this answer
 
v2
Comments
Kornfeld Eliyahu Peter 23-Sep-14 2:51am    
Which means that OP has a design problem - those TextBoxes should not be re-created, but re-binded!!!
Mohd Wasif 23-Sep-14 2:55am    
Yes correct but in this page I have not used $(document).ready() function.
Should I need to make changes in "bootstrap-select.js" file or some where else please suggest
Your post-back initiated from an UpdatePanel which means AJAX call and partial update.
The parts of your page not involved in that partial update will not be touched by the browser and for that the JavaScript code will not run again...
Looking at your code it seems to me that you need not run it again anyway, and if the visuals of your page are messed up after post-back you have a design problem...
 
Share this answer
 
Comments
Mohd Wasif 23-Sep-14 2:48am    
Yes You are right the visuals of pages is not working properly.
Kornfeld Eliyahu Peter 23-Sep-14 2:53am    
It seems you are updating parts of your page that are outside any UdatePanel and for that your page goes wrong...
Please read here to learn how to utilize UpdatePanel: http://msdn.microsoft.com/en-us/library/vstudio/bb386454(v=vs.100).aspx

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