Tag Archives: WebRequest

Open an Url on Asp.Net ModalPopupExtender Ajax Toolkit And Alternative Approaches


Traditional javascript using window.open(url) function to open an Url on new browser window.
Developers can post a form to new window or build a data entry page. window.open(url) function is simple but if it opens new browser several times then overall application could become overwhelming.

We can use ModalPopupExtender instead of window.open function. ModalPopupExtender is an Ajax Control Toolkit to create a modal popup. Modal popup is a dialog box that always on top of a page. You cannot access parent page if modal popup still appear so you need to close it first.
I already have a blog post explaining and showing example about ModalPopupExtender, please follow this Create a PopUp Dialog with ModalPopupExtender AjaxControlToolkit

ModalPopupExtender usually has a Panel Control and inside this Panel we can have any control like label, textbox, button etc. ModalPopupExtender usually has an OK and Cancel button inside Panel.
Those OK and Cancel buttons actually close the modal popup.

The question is how can we open an Url and show it inside Modal Popup? We can just fill in the Url’s HTML source code string into Panel inside the Modal Popup.
So that we can have dynamic content on that modal popup

One way to get Url’s HTML source code is using WebRequest Class. This WebRequest Class can get the response stream of Url and we convert it to string using StreamReader Class.

Continue reading

Introduction To Asp .Net Ajax Client Side Development ($get, $addhandler, $removehandler, Sys.Application, Sys.WebForms, Sys.Net)

Asp .Net Ajax has many ways to accomplish simple and complex web application requirement. As a brief Asp.Net Ajax has Server and Client Side development.
Often Server and Client Side mixed to make Ajax development more confinient.

Server side development process UI update by sending a response from server machine whereas Client side process all UI update on client or user machine side.
In development point of view, Server side code is simpler. But the process uses more resources on server machine. Client side code requires more Js scripting, so in the end our client script may be much longer than server side script.
Client side Ajax development is more suitable for web applications that have complex user interaction since its doesn’t consume server resouces to update the UI.
But off course, your app logic still remains on server side.

I use Microsoft Ajax Library to simplify client side development. This Ajax Library is a rich framework and used extensively at client script.

If you are new to Asp.Net Ajax then you should visit my previous posts about Ajax Server Controls. I explained and gave example of Asp .Net Ajax for Server side development. Please visit these Urls:Introduction To Asp .Net Ajax (ScriptManager, UpdatePanel, ContentTemplate, Triggers) and Introduction to Asp .Net Ajax – 2 (UpdateProgress).
At general, we have to include controls like ScriptManager, UpdatePanel with its child tag <ContentTemplate> and <Triggers>, and also UpdateProgress.
ScriptManager is must to enable Ajax request. UpdatePanel contains all control which will have Ajax Process and UpdateProgress acts as progress info to indicate that asynchronous process is still working.

Continue reading