Hi
I am getting error - 'mbox_ascx' does not contain a definition for 'lnkRecordDelete_Click' and no accessible extension method 'lnkRecordDelete_Click' accepting a first argument of type 'mbox_ascx' could be found (are you missing a using directive or an assembly reference?)
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MBox.ascx.cs" Inherits="Payroll.MBox" %>
protected void lnkRecordDelete_Click(object sender, EventArgs e)
{
try
{
if (hdfId.Value != "0")
{
try
{
using (SqlConnection con = new SqlConnection(Common.CommonFunction.cnn_Live))
{
SqlCommand cmd = new SqlCommand("sp_EmployeeCategory", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@DocEntryNo", SqlDbType.Int).Value = hdfId.Value;
cmd.Parameters.Add("@Action", SqlDbType.NVarChar).Value = "D";
cmd.Parameters.AddWithValue("@UpdatedBy", SqlDbType.Int).Value = Convert.ToInt32(hdfLoginId.Value);
SqlParameter successParam = cmd.Parameters.Add("@Success", SqlDbType.Bit);
successParam.Direction = ParameterDirection.Output;
con.Open();
cmd.ExecuteNonQuery();
bool success = (bool)successParam.Value;
if (success)
{
string message = Common.CommonFunction.recordDeletedSucessfully;
ShowMessage("", message, "Success");
}
else
{
ShowMessage("Oops...", success.ToString(), "error");
}
GetData();
}
}
catch (Exception ex)
{
ShowMessage("Oops...", ex.Message, "error");
}
}
else
{
ShowMessage("Error", "Record Delete Failed, Please Try Again", "error");
GetData();
}
}
catch (Exception ex)
{
ShowMessage("Oops...", ex.Message, "error");
GetData();
}
}
Thanks
Ramco RamcoPosted Aug 26, 2024, 5:24 AM
Hi Gowtham
In I have below code ony. I am sharing with you full code
Thanks
Gowtham CpPosted Aug 26, 2024, 4:46 AM
If the lnkRecordDelete_Click method isn’t being recognized, start by checking that it’s properly defined in your MBox.ascx.cs file and that the Inherits attribute in your .ascx file matches this class. Rebuilding the project can sometimes clear up these issues, so give that a try if things still aren’t working. Lastly, make sure all your file names and paths are correct. If you’re still running into trouble, just let me know and I’ll be happy to help further!