0

I'm new to session management so can anyone tell me ,How to store multiple values selected from gridview into session.
and retrieving that values stored in session in another page..

any suggestions r appreciated..pls help..

6
Contributors
5
Replies
15
Views
7 Years
Discussion Span
Last Post by annaharris
0

>How to store multiple values selected from gridview into session.

Have a look.

...
DataTable dt=new DataTable();
if(Session["key"]==null) {
    dt.Columns.Add("Name");
    Session["key"]=dt;
}
dt=(DataTable)Session["key"];

dt.Rows.Add("Sample");
...
0

Hello There..
i created this code...plz refer it..
i hope this is will work for u..

string[] splitData;
        if (Session["name"] == null)
        {
        }
        else
        {
            string valuefromsession = Session["name"].ToString();
            splitData = valuefromsession.Split('.');
            for (int i = 0; i < splitData.Length-1; i++)
            {
                Response.Write("Name :" + splitData[i].ToString() + "<br/>");
            }
        }
0

i tried the above
it gave me the following error

Conversion from string "Branch" to type 'Integer' is not valid.

0

Can you please provide me your code, so that I can check it and try to rectify your issue.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.