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..

Recommended Answers

All 5 Replies

>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");
...

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/>");
            }
        }

i tried the above
it gave me the following error

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

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

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.