views:

793

answers:

2

I have main page into which i load a user control with a grid and add/edit link buttons.

If I bind the grid by setting the datasource and calling the datebind() method in the page load event then it sets properly. However, I want to keep the selected row between postbacks, so I wrap the bind code in "if (!Page.IsPostBack) {}" as usual. My problem is the page load always registers it as a postback and my code never runs.

I am using the 2.0 framework, and mu grid is an 2008.1 infragistcs for the 2.0 framework.

I thinking this must be something simple.... or hoping anyway!

Thanks in advance

+1  A: 

If you place your control into an UpdatePanel, then you should check for Page.IsCallback instead of Page.IsPostBack.

M4N
Callback is always false.
littlechris
Its always a postback since I'm loading the cotrl into the page. I've loaded the control at main page load to allow me to get on with the development. I might jsut use a session var to replace the ispostback functionality... unless you have any nicer solutions?
littlechris
A: 

The two ways I found round this were:

  1. to load the user controls when the page is first loaded and then hide them until user selected what they need to see.
  2. to load a new page into an iframe on the main page allowing it to have its own page control meaning when its loaded in at first its not a postback.

Not the greatest, but gets by.

Thanks for the help.

littlechris