In below ddlbook_selectedindexchanged i want to display data in modal if Result != null. If records are found then data should be displayed in Modal
C#
protected void ddlBook_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
if (ddlBook.SelectedItem.Value != "")
{
GetSession(Convert.ToInt32(ddlBook.SelectedItem.Value));
List StudentCollection = new List();
BALGroupParticipant bALGroupParticipant = new BALGroupParticipant();
List objStudentList = bALGroupParticipant.GetGroupParticipantsList(Convert.ToInt32(hdfGroupID.Value));
BALStudents bALStudents = new BALStudents();
if (objStudentList != null)
{
foreach (var colum1 in objStudentList)
{
StudentCollection.Add(colum1.StudentID.ToString());
}
}
Int32 BookID = Convert.ToInt32(ddlBook.SelectedItem.Value);
BALSessionDeliveryParticipant bALSessionDeliveryParticipant = new BALSessionDeliveryParticipant();
View_SessionDeliveryParticipant_Detailed Result = bALSessionDeliveryParticipant.GetSessionDeliveryParticipantBookHistory(Convert.ToInt32(ddlBook.SelectedItem.Value), StudentCollection);
if (Result != null)
{
ShowMessage("For Your Information", Result.Name + " in Session - " + Result.SessionDeliveryNo + " dated : " + Convert.ToDateTime(Result.SessionDate).ToString("dd-MM-yyyy"), "info");
//Int32 sr = 1;
}
}
else
{
GetSession(0);
}
BindData(Convert.ToInt32(hdfGroupID.Value), Convert.ToInt32(hdfModuleID.Value), false);
}
catch (Exception ex)
{
Utility.SaveErrorLog(ex.Message, System.IO.Path.GetFileName(Request.Path), System.Reflection.MethodBase.GetCurrentMethod().Name, Convert.ToInt32(hdfLoginCode.Value));
ShowMessage("Oops...", ex.Message, "error");
}
}Thanks

Rajkiran SwainRank #165 · 14.4K reputationPosted Apr 10, 2023, 7:49 AM EDT
protected void ddlBook_SelectedIndexChanged(object sender, EventArgs e) { try { if (ddlBook.SelectedItem.Value != "") { GetSession(Convert.ToInt32(ddlBook.SelectedItem.Value)); List StudentCollection = new List(); BALGroupParticipant bALGroupParticipant = new BALGroupParticipant(); List objStudentList = bALGroupParticipant.GetGroupParticipantsList(Convert.ToInt32(hdfGroupID.Value)); BALStudents bALStudents = new BALStudents(); if (objStudentList != null) { foreach (var colum1 in objStudentList) { StudentCollection.Add(colum1.StudentID.ToString()); } } Int32 BookID = Convert.ToInt32(ddlBook.SelectedItem.Value); BALSessionDeliveryParticipant bALSessionDeliveryParticipant = new BALSessionDeliveryParticipant(); View_SessionDeliveryParticipant_Detailed Result = bALSessionDeliveryParticipant.GetSessionDeliveryParticipantBookHistory(Convert.ToInt32(ddlBook.SelectedItem.Value), StudentCollection); if (Result != null) { // Add this line to show the modal with the data Page.ClientScript.RegisterStartupScript(this.GetType(), "ShowModal", "$('#myModal').modal('show');"); // Set the data to be displayed in the modal lblModalTitle.Text = "For Your Information"; lblModalBody.Text = Result.Name + " in Session - " + Result.SessionDeliveryNo + " dated : " + Convert.ToDateTime(Result.SessionDate).ToString("dd-MM-yyyy"); divModalAlert.Attributes["class"] = "alert alert-info"; } } else { GetSession(0); } BindData(Convert.ToInt32(hdfGroupID.Value), Convert.ToInt32(hdfModuleID.Value), false); } catch (Exception ex) { Utility.SaveErrorLog(ex.Message, System.IO.Path.GetFileName(Request.Path), System.Reflection.MethodBase.GetCurrentMethod().Name, Convert.ToInt32(hdfLoginCode.Value)); ShowMessage("Oops...", ex.Message, "error"); } }