Ajax Enabled Web User Control in ASP.NET

ASP.NET allows to create Web User Control and use it in Web Form like any other ASP.NET Web control. It increases code reusability eventually. Moreover, you can use Web User Control by just dragging and dropping it in your Web Form.

Let’s Start with a simple one. Add a Web User Control to your project, name it FirstWebUserControl.

Now, drag and drop two Labels and Two Radio Buttons in it. However, you need to add your control in Webpage to view it in browser.

Just, select FirstWebUserControl.ascx, drag and drop it in your Web Form say “Home”. It’s now possible to view Web User Cotrol in browser.

To create an AJAX enabled Web User Control, add an UpdatePanel to it, cut and paste Web Controls inside the update panel. Don’t forget to enable AutoPostback of those two Radio Buttons.

Moreover, it’s mandatory to have at least a ScriptManager in Web Form to get AJAX working.

Download Source Code. Here, I have created Two Web User Controls; “LoginUserControl” and “VotingUserControl”. Later one is Ajax enabled.

A Rahim Khan

  1. Thanks .. I put ToolScriptManager in main aspx page where the placeholder is. It’s working now… :D

  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: