I am developing an ASP.NET application. I have a form that I designed using the WEB controls. After collecting information from the user, like Social Security number and name, I add a record to a database. The record is added in the VB code for the on-click.
If there is an error with the database, or if a duplicate record is going to be added, I want to display a popup menu on the client side. The MessageBox.show is a server class (as I understand it) and would not work for the client side. How do you put up a popup window from the VB class generated from the page class?
MessageBox is not a server class, it's a Windows Forms class, and as such it can't be used in ASP.NET. On the client-side you can only use scripting. The proper way of doing what you want would be:
That line will cause the script block to be placed at the bottom of the page and be executed as soon as the page has finished loading. There are several other RegisterXXX methods to emit client-side code from within your server side code.
Dig Deeper on Win Development Resources
Related Q&A from Daniel Cazzulino
Here Daniel Cazzulino explains how to load a DSL (domain specific language) domain model instance file programmatically. This requires the .NET type ... Continue Reading
Here we offer a glimpse at 12 of .NET development expert Danny Cazzulino's top ASP.NET questions and answers. Continue Reading
C# developers should NOT be modifying InitializeComponent method in the code-behind (or any of the variable definitions) by hand. Continue Reading
Have a question for an expert?
Please add a title for your question
Get answers from a TechTarget expert on whatever's puzzling you.