here is an example of what i am doing
Page Load { //Adds items to a panel (not an updatepanel just a normal panel control) } protected void btnNexMod_Click(object sender, EventArgs e) { // Calls DoWork() and Appends more items to the same panel }
My problem is that the asp: button does the DoWork() and also calls DoWork()
Therefore, re-invoking my page load, re-initializing my panel: (
I want my objects that I added to the panel to stay there!
All help was appreciated without looking for the hand you answered, like a deal. Any steps are welcome thank you!
Here is an exact example of my problem.
protected void Page_Load(object sender, EventArgs e) { CheckBox chkbox = new CheckBox(); chkbox.Text = "hey"; chkbox.ID = "chk" + "hey";
The only thing on the page is an empty panel and a button with this click, even a handler.
I tried this too and it still doesn't work. Now its cleaning of the initial element is added to the panel.
if (!Page.IsPostBack) // to avoid reloading your control on postback { CheckBox chkbox = new CheckBox(); chkbox.Text = "Initial"; chkbox.ID = "chk" + "Initial"; // Add our checkbox to the panel Panel1.Controls.Add(chkbox); }
source share