Hi
In below code i am getting error
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(@"<script language='javascript'>"); sb.Append(@"$('#modal_form_horizontal').modal({backdrop: 'static',keyboard: true, show: true});"); sb.Append(@"</script>"); ClientScript.RegisterStartupScript(this.GetType(), "JSScript", sb.ToString()); }
Thanks
The error you're encountering (ShowPopup is not defined) suggests that the JavaScript function ShowPopup is either missing or not defined in the client-side code and not sure about this method "private void ShowPopUp()" ?
ShowPopup is not defined
ShowPopup
Steps to fix the issue
1) Correct the JavaScript Funcation Name to "ShowPopUp"
<script type="text/javascript"> 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 }); } </script>
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.Browser is returning a valid browser string.
Request.Browser.Browser