asp.net - create dynamic controls on button click -


I'm trying to create a dynamic control by clicking on the button using the following code. It creates a text box for the first time, but it is not making control of 2, 3 or 4 etc. What could be the issue?

  & lt; ASP: Place Holder ID = "Place Holder 1" Runat = "Server" & gt; & Lt; / Asp: place holder & gt; & Lt; Asp: button id = "addText" runat = "server" text = "add" onclick = "addnewtext_Click" /> Protect Int Nanbrof Control ({} return (Int) Drishystet [ "Nukantrolols"];} set {viewstate [ "Nukantrols"] = value;}} private vain Pej_lod (object sender, Sistm.aventargs e) {if (! Page . Aispostbak) This.NumberOfControls = 0;} protected void addnewtext_Click (object sender, EventArgs e) {textBox tx = new textBox (); Tx.ID = "ControlID_" + Snkyaof control. Tostring (); PlaceHolder1.Controls. add (TX); Thisknumbrokntrols ++;}  

When you create such visual state should not be updated. So every time you press the server, you are missing to add a control and rest. Because your place holder in a particular location, so it may cause problems in a position to control. when you create dynamic controls and are made of stable control then vary the time. when looking at the state Things, your dynamic controls are still missing, but see the data about their state. See the link below.


Comments

Popular posts from this blog

apache - 504 Gateway Time-out The server didn't respond in time. How to fix it? -

c# - .net WebSocket: CloseOutputAsync vs CloseAsync -

c++ - How to properly scale qgroupbox title with stylesheet for high resolution display? -