michael1174
asked on
Looping through datagrid and prompting user with a OK/Cancel or Yes/No message box
I'm am looping through a datagrid, and depending on some logic, I want to prompt the user within the loop if they want to continue or not. So, I need to have a message box embedded in my loop that has an OK/Cancel or Yes/No prompt. What do I need to do to get this working?
This would be written in c# ASP.NET
Below in my code, the part where it verified for the "W", I put code where I need this to work, it reads:
if msgbox("WARNING: Form <form #> is already attached to this risk. Would you like to attach again?) = yes then
Session["WordingAttached"] = "false";
else
Session["WordingAttached"] = "true";
end if
So, I need the code modified above to work....
Thanks...
This would be written in c# ASP.NET
Below in my code, the part where it verified for the "W", I put code where I need this to work, it reads:
if msgbox("WARNING: Form <form #> is already attached to this risk. Would you like to attach again?) = yes then
Session["WordingAttached"]
else
Session["WordingAttached"]
end if
So, I need the code modified above to work....
Thanks...
foreach(DataGridItem dgAttachedItem in dgAttachedWordings.Items)
{
if (dgAttachedItem.Cells[1].Text == dgItem.Cells[1].Text)
{
//wording duplicate rules
if (dgAttachedItem.Cells[3].Text == "T" || dgItem.Cells[4].Text == "T")
{
MsgBox("Form " + dgAttachedItem.Cells[1].Text + " is already attached to the risk. Duplicate attachment of this form not allowed.");
Session["WordingAttached"] = "true";
}
else if (dgAttachedItem.Cells[3].Text == "A" || dgItem.Cells[4].Text == "A")
{
Session["WordingAttached"] = "false";
}
else if (dgAttachedItem.Cells[3].Text == "W" || dgItem.Cells[4].Text == "W")
{
if msgbox("WARNING: Form <form #> is already attached to this risk. Would you like to attach again?) = yes then
Session["WordingAttached"] = "false";
else
Session["WordingAttached"] = "true";
end if
}
else
{
Session["WordingAttached"] = "true";
}
break;
}
else
{
Session["WordingAttached"] = "false";
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.