Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET viewstate Controls , +
using System;
using System.Collections.Generic;<small></small>
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.Security;
using System.IO;
using System.Data;
using System.Data.SqlClient;
using System.Web.Configuration;
using System.Configuration;
 
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;
    string _Imgname = string.Empty; // Extracts the img name
    string _ImgPath = string.Empty;// can be called to store the img path
 
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);// on a placeholder
        lblCat.EnableViewState = true;
 
        txtCat = new TextBox();
        _Cat = txtCat.Text;
        PhtxtCat.Controls.Add(txtCat);// on a placeholder
 
    }
 
    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);// on a placeholder
 
        txtSubCat = new TextBox();
        _SubCat = txtSubCat.Text;
        PhtxtSubCat.Controls.Add(txtSubCat);// on a placeholder
    }
}
 
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!
Posted 13-Jul-13 8:16am
Comments
ThePhantomUpvoter at 13-Jul-13 13:17pm
   
Can you ask a question without screaming at people?
Sugu Thomas at 13-Jul-13 13:28pm
   
I am not screaming......
ryanb31 at 13-Jul-13 22:20pm
   
ALL CAPS IS SCREAMING.

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Create both Category and subcategory in one button click (i-e) create both in single click
  Permalink  
Comments
Sugu Thomas at 14-Jul-13 10:34am
   
Yes, I was palnning to do that....I think that is the only way.....Thank you,@Zafar....

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 BillWoodruff 360
1 Mathew Soji 309
2 Maciej Los 270
3 DamithSL 225
4 Afzaal Ahmad Zeeshan 202
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 14 Jul 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100