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