Monday, April 28, 2008

Session Variables II

I came to a point where I was getting his page, but it would not have the correct site information. This meant that the session variable Hazard_ID was not being passed.
I tried adding it to the end of the URL as in http://jn-svrdev1-vma6:81/spar/csp/EditSite.aspx?Hazard_ID=number. This did not work.

Today, I set the DataKeyNames="HazardID" in the asp section of GridView (found on the page that has HTML) instead of on PageLoad() in the code section (found in the C# code behind the aspx page.

I used the following in the OnSelectedChanged and erased last week's coding:
  • int index = GridView1.SelectedIndex;
  • // Display the primary key value of the selected row.
  • txtHazard_ID.Text = GridView1.DataKeys[index].Value.ToString();
I put the correct Hazard_ID in the textbox and selecting Submit button now gives me an error concerning an "ActiveButton" session variable on the EditSites page.

No comments: