Click here to Skip to main content
14,690,908 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
hi coders,
im developing a site where im using a master page which includes a search panel.when i search an employee i used to show all the employees in griview and i can select the employee by clikin on gridview row.when i clik on gridview row im creating a session variable of that employee's ID.
but im not gettin that session var on content page bcuz content page loads first.im gettin that session var on second page-load. how to resolv this issue.

please help
Posted

1 solution

kingvegeta wrote:
but im not gettin that session var on content page bcuz content page loads first.

This is as per the Page Life Cycle.


kingvegeta wrote:
when i clik on gridview row im creating a session variable of that employee's ID.

From what you have written, gridview is in Master Page, if so, setting of the Employee ID session would take place in Master Page Grid row click event. Though if Grid is in Content page(which general page design suggests!) you should be able to set the EmloyeeID in grid row event used in Content Page.

You have to code as per the Page Life cycle. If your grid is in Master page and you want to use a Employee ID session in Content page then you have to wait for the Master Page event to finish. You cannot get the value that is about to be set late in page execution.

Master pages should be used for replicating certain UI across pages. Search type of feature should be in Content page and thus you can set Session in content page event and thus use it accordingly to render the contents.
   
Comments
alok lingayat 5-May-10 0:15am
   
thnx sandip,
u ask me to include search code in content page but then there are several pages (about 30 pages to be precise) where i need to do that. so thinkin that i included search code in master page.Is ther any other way to achieve same as master page where i dont have write all search code again n again
Sandeep Mewara 5-May-10 1:16am
   
See, it is your design flaw! If you are using search in 30 pages, you should had made it a 'user control' and used every where. That would had resolved your issues.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900