Hi
I have below code . I want when value in dropdown changes then it should search that Session Delivery No value in table row & highlight that column
C#
htmlTable.Append("");
htmlTable.Append("" + colum.SessionDeliveryCalendarID + "");
htmlTable.Append("" + colum.BookID + "");
htmlTable.Append("" + colum.SessionID + "");
htmlTable.Append("" + colum.SessionDeliveryNo + "");
htmlTable.Append("");
PlaceHolderTable.Controls.Add(new Literal { Text = htmlTable.ToString() });
protected void ddl_SelectedIndexChanged(object sender, EventArgs e)
{
// session deleivery no value
}Thanks

Mohamed Azarudeen ZRank #297 · 8.5K reputationPosted Jun 9, 2023, 2:34 AM EDT
Hi ramco try this
.highlight { background-color: yellow; }SessionDeliveryNovalue. The class attribute will be initially empty, but we'll update it dynamically based on the dropdown selection. Replace the line that appends the table cell as follows:htmlTable.Append("" + colum.SessionDeliveryNo + "");tag or in an external JavaScript file:// Get the dropdown element var ddl = document.getElementById("ddl"); // Attach an event listener to the dropdown's change event ddl.addEventListener("change", function () { var selectedValue = ddl.value; // Get all the table cells with the 'sessionDeliveryNo' class var cells = document.getElementsByClassName("sessionDeliveryNo"); // Loop through the cells and remove any existing highlighting for (var i = 0; i < cells.length; i++) { cells[i].classList.remove("highlight"); } // Loop through the cells and check if their text matches the selected value for (var i = 0; i < cells.length; i++) { if (cells[i].textContent === selectedValue) { // Add the 'highlight' class to the matching cell cells[i].classList.add("highlight"); } } });