tags:

views:

20

answers:

1

hi, I have a web project which includes two button in a view.when i click a button some textboxes along with that second button have to be visible.After entering data in textboxes,when i am trying to click the second button, its not working.What should i do to make it work? Thanks in advance.

+12  A: 

Rahul try this

In aspx page

<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />
        <asp:Button ID="Button2" runat="server" Text="Button" onclick="Button2_Click" />

In aspx.cs page

protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Button2.Visible = false;
            TextBox1.Visible = false; 
        }
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        Button2.Visible = true;
        TextBox1.Visible = true;
    }
    protected void Button2_Click(object sender, EventArgs e)
    {
        TextBox1.Text = "Testing";
    }
Pankaj Mishra