Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

After binding my session variables at set to 0

Avatar of kimmie8000
kimmie8000Flag for United States of America asked on
2 Comments1 Solution294 ViewsLast Modified:
Once the code is binds to the grid.  I lose my session variables which makes updating an issue.

Can someone tell me how to keep my session variable for the update part of the LINQ query?

public void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
        LabelAcknMessage.Text = string.Empty;
        GridView1.EditIndex = e.NewEditIndex;
        // Get table and row for editing with index selected... This is when you click edit.
        string strJobTitleName = (GridView1.Rows[e.NewEditIndex].FindControl("lblJobTitle") as Label).Text;
        if (strJobTitleName != null)
            HCGASF_MaintDataContext db = new HCGASF_MaintDataContext();
            var JobTitle = (from jt in db.JobTitles
                                where jt.JobTitleName == strJobTitleName
                            select jt).SingleOrDefault();
            Session["OLD_JobTitleID"] = JobTitle.JobTitleID;
            // test string make sure it is in the right number.
            string strTitle = Session["OLD_JobTitleID"].ToString();
            intTitle = Convert.ToInt32(strTitle);

        string strHCApplicationName = (GridView1.Rows[e.NewEditIndex].FindControl("lblHCApplication") as Label).Text;
        if (strHCApplicationName != null)
            HCGASF_MaintDataContext db = new HCGASF_MaintDataContext();
            var HCApp = (from ap in db.HomeCareSoftwareLists
                         where ap.HCApplication == strHCApplicationName
                            select ap).SingleOrDefault();
            Session["OLD_HCApplicationID"] = HCApp.HCSoftwareID;
            // test string make sure it is in the right number.
           string strHC = Session["OLD_HCApplicationID"].ToString();
           intHC = Convert.ToInt32(strHC);

Avatar of kimmie8000
kimmie8000Flag of United States of America image

Our community of experts have been thoroughly vetted for their expertise and industry experience.

This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answers