I have three textboxes & one button Add & one Gridview.I want to add the textboxes data in Gridview on button click.

GridView1.DataSource=new String[]{TextBox1.Text,TextBox2.Text,TextBox3.Text};
GridView1.DataBind()

hello,its not working..

protected void btnSubmit_Click(object sender, EventArgs e)
    {
        GridView1.DataSource = new String[] { txtRoll.Text, txtName.Text };
        GridView1.DataBind();
    }
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.