I have to show users entered parameters in Asp.net Gridview example some values from dropdownlist textboxes and startDate EndDate etc . I am getting these values from user and a
Am not sure for you scenario. But here is the thing for adding grid view dynamically without using database.
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
DataTable date = new DataTable();
date.Columns.Add("Column !", typeof(string));
date.Columns.Add("Column 2", typeof(string));
Session["dte"] = date;
}
}
protected void addbutton_Click(object sender, ImageClickEventArgs e)
{
DataTable date = (DataTable)Session["dte"];
DataRow dr = date.NewRow();
dr["Column 1"] = TextBox1.Text.Trim();// Your Values
dr["Column 2"] = TextBox2.Text.Trim();// Your Values
date.Rows.Add(dr);
GridView1.DataSource = date;
GridView1.DataBind();
}
It may help you to over come this hurdle. Please let me know your further queries in this case.
You need to get the previous datatable
from session
and read it and put rows in it. This should be done at addrow AddButton_Click
event.