Article: Use AJAX Modal Popup Extender inside GridView in ASP.Net
Hellow sir I am tring generate a click event from javascript to bind the Checkboxlist value coming from backend under asp panel here is my front end code
<div>
<table>
<tbody>
<tr>
<th>Division</th>
<td>
<asp:Panel ID="pnldiv" runat="server" Height="200px" Width="300px" GroupingText=" "
ScrollBars="Auto">
<asp:CheckBoxList ID="chkdiv" runat="server" class="b">
</asp:CheckBoxList>
</asp:Panel>
</td>
</tr>
</tbody>
</table>
</div>
and my binding code like this
chkdiv.DataTextField = "Divname";
chkdiv.DataValueField = "Divname";
chkdiv.DataBind();
it is getting bind to checkboxlist
And i need code that after clicking the checkbox list value it should store in stringvariable with comma seperator in sequence the way i click in javascript and should visible in my pages that what i had selected without loading the page and if i unchecked that value that value should disppear from my page without loading pages.
My javascript code is this
$(function () {
let aaa = '';
$(".b input").click(function () {
var props = $(this).prop('checked');
if (props) {
var i = $(this).val();
aaa += i + ','
}
else {
var i = $(this).val();
var index = aaa.indexOf(i + ',');
if (index !== -1) {
aaa = aaa.slice(0, index) + aaa.slice(index + i.length + 1);
}
}
console.log(aaa);
});
After that i want to click on save button that will save that value in my grid. I will handle this.
Please help.