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";
}
}
}
}
<script>
function GetModuleData(e) {
var currentRow = $(e).closest("tr");
var rp;
// rp = currentRow.find("td:eq(0)").text();
var table = document.getElementById("grdPlanning"), rIndex, cIndex, track;
// table rows
for (var i = 1; i < table.rows.length; i++) {
for (var j = 0; j < table.rows[i].cells.length; j++) {
table.rows[i].cells[j].onclick = function () {
rIndex = this.parentElement.rowIndex;
cIndex = this.cellIndex;
if (cIndex > 0) {
Mobile = $('table tr th:eq(' + (cIndex) + ')').text();
BookId = currentRow.find("td:eq(0)").text();
var str = Mobile;
const result = str.split(/[()]/);
var res1 = result[0];
var res2 = result[1];
document.getElementById('hdfBookId').value = BookId;
document.getElementById('hdfMobile').value = res2;
};
};
}
}
};
</script>
Thanks