Adding new content to a session
I have an asp.net dropdown list and an asp.net gridview control. On
changing the dropdownlist element , a new row is fetched from the
database.
I am storing this in a session .Next time there is a change in the
dropdownlist element , there will be a new row fetched from the database
and I would like to add that row too , to the session.
I have the dropdownlist_selectedIndexchanged event below :
protected void ddlClient_SelectedIndexChanged(object sender, EventArgs e)
{
int x = int.Parse(ddlClient.SelectedValue);
DataSet ds = GetRowFromDatabase( x);
Session["old"] = ds;
((DataSet)Session["old"]).Merge(ds);
gridview.DataSource = Session["old"] ;
gridview.DataBind();
}
I cannot figure out how to keep appending my rows in the session variable,
each time my dropdownlist changes ?
No comments:
Post a Comment