Attribute | Description |
---|---|
ID | Identifies the ModalPopupExtender control |
TargetControlID | Specifies the control that activates the ModalPopupExtender control |
PopupControlID | Specifies the control to display as a modal popup |
OkControlID | Specifies the control that dismisses the modal popup |
CancelControlID | Specifies the control that cancels the modal popup |
OnOkScript | Specifies the script to run when the modal popup is dismissed with the OkControlID |
OnCancelScript | Specifies the script to run when the modal popup is canceled with the CancelControlID |
BackgroundCssClass | Specifies the CSS class to apply to the background when the modal popup is displayed |
Finally, insert the JavaScript functions into the source view of Default.aspx
:
</head>
<body>
The displayPopup()
function looks for the ModalPopupExtender
control in the page and displays the modal popup. The OK_Click()
function is called when the user decides to proceed with the deletion. It hides the modal popup and initiates a postback to the server. The No_Click()
function is called when the user cancels the deletion. It hides the modal popup.
That's it! Press F5 to test the application.
In this particular example, you will get a runtime error if you proceed with the deletion. That's because the titles
table is related to the titleauthor
table (also part of the pubs
database), and deleting a record in the titles
table violates the reference integrity of the database.
Summary
This chapter developed a simple ASP.NET web application that displays data stored in a database. One of the new features in ASP.NET 3.5 is the LinqDataSource control that enables you to bind directly against a LINQ- enabled data model instead of a database, so instead of specifying SQL statements for querying data, you can use LINQ queries. You also saw how to use the built-in AJAX support in ASP.NET 3.5 to create responsive AJAX applications.
Chapter 18
Developing Windows Mobile Applications
The mobile application platform has gained a lot of interest among enterprise developers in recent years. With so many mobile platforms available, customers are spoiled for choice. However, at the front of developers' minds are the various criteria that they need to evaluate before deciding on the platform to support. These factors are: