Hello All,
I have to store values selected by the user in a datatable and display in datagrid. My question is how i can store value the value selected by the user without loosing the previous value stored in datatable.
Any suggestions are appreciated. Thanks in advance, Shilpa.
Here is the code i have written but dosent work as the old value is replaced with new one after postback
protected void ddlList_SelectedIndexChanged(object sender, EventArgs e)
{
Txt.Text = ddlList.SelectedValue;
DataTable dt = new DataTable();
DataColumn dc = new DataColumn();dc.DataType = Type.GetType("System.Int32");dc.ColumnName = "property_option_idx";
dt.Columns.Add(dc);
DataRow dr = dt.NewRow();
// row["id"] = Guid.NewGuid().ToString();dr["property_option_idx"] = ddlList.SelectedValue;
dt.Rows.Add(dr);
Session["dt"] = dt;GridView1.DataSource = ((DataTable)Session["dt"]).DefaultView;
GridView1.DataBind();
// this.GridView1.DataSource = ((DataTable)Session["myDatatable"]).DefaultView;
}