Create Generate Run Time JQuery Dynamic Content Controls in a DIV Asp.Net C# VB.Net

In many cases developers need to add dynamic contents or controls run time in a DIV using JQuery. In my latest project i have done a critical job. In this post i am sharing just a simple example on how to add dynamic controls in a DIV. By following this example you can generate and add on the fly dynamic contents, controls like Button, Link etc in a DIV. The output look like below:

Jquery_runtime_add_Content_in_Div

Steps to Follow:
1. Drag & Drop the JQuery library in your page

<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>

2. Add a Server Side Button

<asp:Button ID="Button1" runat="server" Text="Add Dynamic Contents" />

3. Add a DIV where you want to dynamically add Contents in runtime

<div id="divDynamic"></div>

4. Write the JQuery Function

    <script type="text/javascript">
    $(document).ready(function () {
        $('#<%= Button1.ClientID %>').click(function () {
            $("#divDynamic").append("<b>This is a dynamic content--JQUERY</b></br>");
            return false;
        });
    });
    </script>

Note: The whole process is completely same for both C# & VB.Net

Now hope one can generate dynamic contents by using JQuery power script.

Download Code Example C#        Download Code Example VB.Net

Posted in .Net, Asp.net, C#, Client, JQuery, VB.Net
One comment on “Create Generate Run Time JQuery Dynamic Content Controls in a DIV Asp.Net C# VB.Net
  1. Launch Business in Delhi says:

    Nice post, things explained in details. Thank You.

Leave a Reply

Your email address will not be published. Required fields are marked *

     

*