Necesito agregar un evento a un ASP CheckBox, como todos saben cuando un ASPCheckBox se renderiza produce el siguiente HTML.
Consideren que esto se ejecuta en el ItemDataBound de un DataGrid.
Control ASPNET
Código:
Html generado<asp:CheckBox id="chkRechazar" runat="server"></asp:CheckBox>
Código:
Lo que hago es lo siguiente:<input id="dgrProblemas_1_chkRechazar" type="checkbox" name="dgrProblemas:1:chkRechazar" />
Código:
Y el codigo que me genera es:e.Item.ID = e.Item.ID+count; ((CheckBox)e.Item.FindControl("chkRechazar")).Attributes.Add("onblur", string.Format("javascript:SelectItemGrid({0},this)", e.Item.ClientID)); ((CheckBox)e.Item.FindControl("chkRechazar")).Attributes.Add("onclick", string.Format("javascript:SelectItemGrid({0},this)", e.Item.ClientID));
Código:
Pero yo necesito que los eventos sean asignados al checkbox y no al SPAN, algo asi:<span onblur="javascript:SelectItemGrid(dgrProblemas_1,this)"> <input id="dgrProblemas_1_chkRechazar" type="checkbox" name="dgrProblemas:1:chkRechazar" onclick="javascript:SelectItemGrid(dgrProblemas_1,this)" /> </span>
Código:
Espero puedan ayudarme...<input id="dgrProblemas_1_chkRechazar" type="checkbox" name="dgrProblemas:1:chkRechazar" onclick="javascript:SelectItemGrid(dgrProblemas_1,this)" onblur="javascript:SelectItemGrid(dgrProblemas_1,this)" />
Saludos.