Hi
I have below code. OnClientClick Javascript gets executed . After that i want to execute below code
BALBooks bALBooks = new BALBooks();
BALStudents bALStudents = new BALStudents();
StudentDetail Result = bALStudents.GetStudentDetailByLoginID(bALStudents.GetStudentIDByMobile(hdfMobile.Value));
ltrlHead.Text = Result.Name;
ltrlHead.Text = ltrlHead.Text + " : " + bALBooks.GetBookTitle(Convert.ToInt32(hdfBookId.Value));
BindData(Convert.ToInt32(hdfBookId.Value), Result.LoginCode);
protected void gr_RowDataBound(object sender, GridViewRowEventArgs e)
{
try
{
if (e.Row.RowType != DataControlRowType.DataRow)
return;
e.Row.Cells[0].HorizontalAlign = HorizontalAlign.Center;
for (int i = 8; i < e.Row.Cells.Count - 1; i++)
{
string cellValue = e.Row.Cells[i].Text;
var row = (DataRowView)e.Row.DataItem;
var currentPerson = row[0].ToString();
var currentDate = row.DataView.Table.Columns[i];
var commandArgument = currentPerson + ":" + currentDate;
LinkButton button = new LinkButton();
button.Text = cellValue;
button.CommandName = "Select";
button.CommandArgument = commandArgument;
button.OnClientClick = "GetModuleData(this)";
if (cellValue.ToUpper().Trim() == "A")
{
button.CssClass = "badge badge-danger";
}
}
}
}
Thanks
Ramco RamcoPosted May 16, 2023, 8:50 AM
Hi
It is giving error - Error parsing attribute 'enablepagemethods': Type 'LMS.Coordinator.AddRecommendedBooks' does not have a public property named 'enablepagemethods'.
Thanks
Rajkiran SwainPosted May 16, 2023, 8:27 AM
To achieve this, you can modify the
GetModuleDatafunction in the JavaScript code to execute an AJAX request or redirect to another page where the C# code can be executed. Here's an example using AJAX:In your ASP.NET code-behind (C#), you need to create a web method to handle the AJAX request:
Make sure to replace "YourPage.aspx" with the actual page where your code resides. Also, adjust the AJAX URL accordingly.
Note: If you're using ASP.NET Web Forms, make sure to enable Page Methods by adding
EnablePageMethods="true"to your<%@ Page %>directive.This way, when the
GetModuleDatafunction is executed, it will trigger the AJAX request to