I'm working on WebForm with MasterPage, in this framework I'm not able to make modal call (js) in my C #.
Intheeventofthebutton(intheimageabove)withinamodalthesameasarefreshonthepageandkillsthemodal,followthecodebehindinC#:
protectedvoidbtnImportarGrade_Click(objectsender,EventArgse){strNomeArquivo=DateTime.Now.ToString("dd_MM_yyyy_HH_mm_ss");
if (ValidarGrade(strNome, strTipo, strArquivo))
{
}
}
private bool ValidarGrade(string pstrNome, string pstrTipo, string pstrArquivo)
{
if (string.IsNullOrEmpty(pstrArquivo))
{
strMsg.Append("Selecione o Arquivo.");
}
else if (Path.GetExtension(pstrArquivo.ToLower()) != ".xls")
{
strMsg.Append("Arquivo inválido, só é permitido .xls.");
}
if (!string.IsNullOrEmpty(strMsg.ToString()))
{
ScriptManager.RegisterStartupScript(this, typeof(Page), Guid.NewGuid().ToString(), "$('#ModalNovaGrade').modal('show');", true);
MessageBox.Alert(strMsg.ToString(), Page);
return false;
}
return true;
}
Please complete the validation and refresh on the page. I need to keep it as modal open.