Displaying a Message in a C# web application -
i have switch statement in c# , have default case display error message when implemented. cant use messagebox because web application dont know how other way. have been advised use javascript im not sure how this. im assuming need create pop box in html , implement onclick event last case or something. thank you time
case 8: function break; case 9: function break; default: //insert message here break;
you try this:
// message want display. string message = "your message"; // here build script using stringbuilder object // executed, when onload event of page triggered. stringbuilder sb = new stringbuilder(); sb.append("<script type = 'text/javascript'>"); sb.append("window.onload=function(){"); sb.append("alert('"); sb.append(message); sb.append("')};"); sb.append("</script>"); // here register client script clientscript.registerclientscriptblock(this.gettype(), "alert", sb.tostring());
which place in default
option.
Comments
Post a Comment