How to trigger a datagrid event when a checkbox is checked?

997 Views Asked by At

Inside the data grid in the item template the button was replaced with check box for more feasibility and if I click the button, the panel is displayed accordingly and the panel elements are also displayed along with its contents.

Now my requirement is to change this button in item template with a checkbox and in the header template have included another checkbox.

I am able to select the items in the check and also able to check all in the data grid. I have two panels A and B(say),when i check more than one check box then panel B is to be displayed.

When I check only single checkbox then panel A is only to be displayed.

In my case ,when this check box is checked I am able to see the panels A and B for their corresponding action but the elements inside the panel such as (corresponding row's data base events are not fetched properly) . Can any one explain me clearly how to resolve this with some sample example or can you help in my code?

1

There are 1 best solutions below

0
On

Yes because of event bubbling controls like checkbox cannot fire ItemCommand event. You can try by creating a work around.

Get button back and hide it by adding display:none style , add Client side OnClientClick event call this button's click event using javascript.

e.g.

chk.Add("onclick", "javascript:document.getElementById('" + btn.ClientID + "').click()");