Ayyappan Anbalagan
Ayyappan Anbalagan

Reputation: 11312

How to create the div, dynamically in asp.net

I have some textbox and submit button.

When ever I click the submit button the div should be added dynamically in my aspx page.

Also the information which is available in the text box also displayed in the page default.

Use:Without using database i need to display the user suggestion in my page...

Upvotes: 4

Views: 15967

Answers (1)

Thea
Thea

Reputation: 8067

You have 2 possibilities:

  1. You can add dynamically an asp.net panel which generates div tag.

    // Create dynamic controls here.
    // Use "using System.Web.UI.WebControls;"
    Panel panel1 = new Panel();
    panel1.ID = "MyPanel";
    Form1.Controls.Add(panel1);

  2. Create the div using jQuery

Select the parent element with $("#id"), $("&lt;element&gt;") or $(".class") and then $(theElement).append("<div>Your content</div>");

Upvotes: 13

Related Questions