Quantcast
Channel: Visual C# forum
Viewing all articles
Browse latest Browse all 31927

Dynamic created textbox/label visibility destroyed when i do the next click event....

$
0
0

public partial class Products : System.Web.UI.Page { public static Label lblCat,lblSubcat;

public static TextBox txtCat, txtSubCat;

string _Cat;// stores new Sub cat

string _SubCat; protected void lnkCat_Click(object sender, EventArgs e) { Panel2.Visible = false; Panel1.Visible = true; lblCat = new Label(); lblCat.Text = "Enter new Category: "; PHcat.Controls.Add(lblCat); lblCat.EnableViewState = true; txtCat = new TextBox(); _Cat = txtCat.Text; PhtxtCat.Controls.Add(txtCat); } protected void lnkSubCat_Click(object sender, EventArgs e) { Panel1.Visible = true; Panel2.Visible = true; lblSubcat = new Label(); lblSubcat.Text = "Enter new Sub-Category: "; PHsubCat.Controls.Add(lblSubcat); txtSubCat = new TextBox(); _SubCat = txtSubCat.Text; PhtxtSubCat.Controls.Add(txtSubCat); } }

Here,my problem again is when i click on 'Create Category' link button (lnkCat_Click) dynamically its label and textbox is displayed for category and i have another link button for creating 'SuB-category' and when i click (lnkSubCat_Click) on that button for 'Create Sub category' THE FIRST DYNAMIC CREATED (FOR CATEGORY) LABEL AND TEXTBOX ARE REMOVED.

HERE I WANT TO HOLD THAT DYNAMIC CREATED(CAT AND SUB-CAT) SHOULD BE DISPLAYED TILL I CLICK ON SUBMIT BUTTON ON THE SAME PAGE!

I have two link button to create cat and sub-cat!

CAN U PLEASE HELP ON THIS MATTER? AND IS THIS POSSIBLE?

THANK YOU...EXPECTING A REPLY!



Viewing all articles
Browse latest Browse all 31927

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>