Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create the div, dynamically in asp.net

Tags:

c#

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...

like image 967
Ayyappan Anbalagan Avatar asked Dec 13 '22 22:12

Ayyappan Anbalagan


1 Answers

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>");

like image 161
Thea Avatar answered Dec 26 '22 05:12

Thea