Click here to Skip to main content
15,747,908 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i am using this function it is working fine when i select check box first. but when i select any drop down item its not working

$(function () {
$("#chkIsKmc").click(function () {
if ($(this).is(":checked")) {
$("#inputKmcCode").show();
} else {
$("#inputKmcCode").hide();
}
});
});

What I have tried:

Hide show properties using jQuery
Posted
Updated 8-Mar-17 20:26pm
v2
Comments
Karthik_Mahalingam 9-Mar-17 1:29am    
does post back happens on ddl change?
Mahesh2223 9-Mar-17 1:39am    
yes happens
Karthik_Mahalingam 9-Mar-17 1:46am    
check the solution,
Mahesh2223 9-Mar-17 2:27am    
someone who may face similar problems like me so i am updating question properly

1 solution

try using javascript

<asp:CheckBox ID="chkIsKmc" runat="server" onclick="changevalue(this)" />
     <asp:TextBox ID="inputKmcCode" style="display:none" runat="server"></asp:TextBox>


<script>
     function changevalue(checkbox) {
         document.getElementById('<%= inputKmcCode.ClientID%>').style.display = checkbox.checked ? 'block' : 'none';
     }
 </script>
 
Share this answer
 
Comments
Karthik_Mahalingam 9-Mar-17 1:50am    
cool
Mahesh2223 9-Mar-17 1:54am    
i have to update the query using record id but that value is not in grid
my query i have used stored procedure. but its not taking record how to pass
cmd.Parameters.AddWithValue("@Recordid", SqlDbType.NVarChar);
Karthik_Mahalingam 9-Mar-17 1:57am    
if you dont have id then how will you update ?

add the id in the grid column and hide it in a hidden field control..
Mahesh2223 9-Mar-17 2:03am    
ohh i wil try,, how to skip a grid column based on drop down selection, if i select all it should display 6 , if any list item 5 columns in grid
Karthik_Mahalingam 9-Mar-17 3:37am    
off topic

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

  Print Answers RSS


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