Hi
In below code i am getting error
C#
ShowMessage("Success", "Record Saved Successfully", "Success");
public void ShowMessage(String Title, String Text, String Type)
{
Text = Text.Replace("'", "").Replace("/", " ").Replace(";", " ").Replace(":", " ").Replace(",", " ");
Text = System.Text.RegularExpressions.Regex.Replace(Text, @"\t|\n|\r", " ");
if (Common.CommonFunction.IE(Request.Browser.Browser))
{
Common.MessageBox.Show(Text);
}
else
{
ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopUp('" + Title + "', '" + Text + "','" + Type + "');", true);
}
}
private void ShowPopUp()
{
System.Text.StringBuilder sb = new System.Text.StringBuilder();
sb.Append(@"");
sb.Append(@"$('#modal_form_horizontal').modal({backdrop: 'static',keyboard: true, show: true});");
sb.Append(@"");
ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb.ToString());
}Thanks

abufaizur rahman34 reputationPosted Aug 17, 2024, 1:35 AM EDT
The error you're encountering (
ShowPopup is not defined) suggests that the JavaScript functionShowPopupis either missing or not defined in the client-side code and not sure about this method "private void ShowPopUp()" ?Steps to fix the issue
1) Correct the JavaScript Funcation Name to "ShowPopUp"
function ShowPopup(title, text, type) { alert("Title: " + title + "\nText: " + text + "\nType: " + type); // Or implement your modal popup logic here $('#modal_form_horizontal').modal({ backdrop: 'static', keyboard: true, show: true }); }public void ShowMessage(String Title, String Text, String Type) { Text = Text.Replace("'", "").Replace("/", " ").Replace(";", " ").Replace(":", " ").Replace(",", " "); Text = System.Text.RegularExpressions.Regex.Replace(Text, @"\t|\n|\r", " "); if (Common.CommonFunction.IE(Request.Browser.Browser)) { Common.MessageBox.Show(Text); } else { ClientScript.RegisterStartupScript(this.GetType(), "Popup", "ShowPopup('" + Title + "', '" + Text + "','" + Type + "');", true); } }2.Ensure that
Request.Browser.Browseris returning a valid browser string.