Click here to Skip to main content
15,886,740 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
C#
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
Comments
[no name] 13-Jul-13 13:17pm    
Can you ask a question without screaming at people?
Sugu Thomas 13-Jul-13 13:28pm    
I am not screaming......
ZurdoDev 13-Jul-13 22:20pm    
ALL CAPS IS SCREAMING.

1 solution

Create both Category and subcategory in one button click (i-e) create both in single click
 
Share this answer
 
Comments
Sugu Thomas 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900