Hi
I have below code . Problem is on Dropdown PostBack BackGround color gets cleared
<asp:DropDownList ID="ddlBook" class="form-control" required="true" parsley-trigger="change" runat="server" OnSelectedIndexChanged="ddlBook_SelectedIndexChanged" AutoPostBack="true"> <asp:ListItem Value="">Select Book</asp:ListItem> </asp:DropDownList></td> <script> var ddl = document.getElementById("ddlBook"); ddl.addEventListener("change", function () { var selectedText = ddl.selectedOptions[0].textContent; var table = document.getElementById("tbldata"); // Replace "myTable" with the ID of your table for (var i = 0; i < table.rows.length; i++) { var row = table.rows[i]; var cell = row.cells[7]; if (cell.textContent == selectedText) { alert(cell.textContent); alert(selectedText); cell.style.backgroundColor = "yellow"; } } }); </script>
Thanks