hi,
"Sys.InvalidOperationException: Sys.InvalidOperationException: A control is already associated with the element." i have this error on delete button click inside grid.so provide solutions.
my code is:
function deletepermission(id) {
var add = $("#" + "<%=Per_delete.ClientID %>").val();
if (add == 0) { bootbox.alert("You have no permissions to Update Record");}
else {
bootbox.confirm("Are you sure you want to Delete the Record?", function (result) {
if (result == true) {
$("#" + "<%=gridId.ClientID %>").val(id);
$("#" + "<%=btn_Delete_actual.ClientID %>").click();
}
});
}
}
<telerik:GridTemplateColumn AllowFiltering="false" UniqueName="Action" HeaderText="Action" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Button runat="server" ID="btnDelete" ToolTip="DeleteRecord" Text="Delete" onclientclick='<%# Eval("LandlordId","deletepermission({0})") %>' Height="22px"></asp:Button>
</ItemTemplate>
</telerik:GridTemplateColumn>
<asp:Button runat="server" ID="btn_Delete_actual" onclick="btn_Delete_actual_Click" style="display:none;"></asp:Button>
<asp:HiddenField ID="gridId" runat="server"></asp:HiddenField>
serverside code:
protected void btn_Delete_actual_Click(object sender, EventArgs e)
{
int lid = Convert.ToInt32(gridId.Value);
if (lid > 0)
{
if (s.DeleteLandlord(lid) == true)
{
msg.Style.Add("display", "block");
lbl_msg.Text = "Record Deleted sucsessfully..";
lbl_msg.Style.Add("color", "green");
GetLandlord();
}
}
}
Thanks,
Rahul
"Sys.InvalidOperationException: Sys.InvalidOperationException: A control is already associated with the element." i have this error on delete button click inside grid.so provide solutions.
my code is:
function deletepermission(id) {
var add = $("#" + "<%=Per_delete.ClientID %>").val();
if (add == 0) { bootbox.alert("You have no permissions to Update Record");}
else {
bootbox.confirm("Are you sure you want to Delete the Record?", function (result) {
if (result == true) {
$("#" + "<%=gridId.ClientID %>").val(id);
$("#" + "<%=btn_Delete_actual.ClientID %>").click();
}
});
}
}
<telerik:GridTemplateColumn AllowFiltering="false" UniqueName="Action" HeaderText="Action" ItemStyle-HorizontalAlign="Left" HeaderStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Button runat="server" ID="btnDelete" ToolTip="DeleteRecord" Text="Delete" onclientclick='<%# Eval("LandlordId","deletepermission({0})") %>' Height="22px"></asp:Button>
</ItemTemplate>
</telerik:GridTemplateColumn>
<asp:Button runat="server" ID="btn_Delete_actual" onclick="btn_Delete_actual_Click" style="display:none;"></asp:Button>
<asp:HiddenField ID="gridId" runat="server"></asp:HiddenField>
serverside code:
protected void btn_Delete_actual_Click(object sender, EventArgs e)
{
int lid = Convert.ToInt32(gridId.Value);
if (lid > 0)
{
if (s.DeleteLandlord(lid) == true)
{
msg.Style.Add("display", "block");
lbl_msg.Text = "Record Deleted sucsessfully..";
lbl_msg.Style.Add("color", "green");
GetLandlord();
}
}
}
Thanks,
Rahul