views:

234

answers:

1

I'm still fairly new to ASP.Net, so forgive me if this is a stupid question.

On page load I'm displaying a progress meter after which I do a post back in order to handle the actual loading of the page. During the post back, based on certain criteria I'm disabling certain links on the page. However, the links won't disable. I noticed that if I force the links to disable the first time in (through debug) that the links disable just fine. However, I don't have the data I need at that time in order to make the decision to disable.

Code Behind

If (Not IsCallback) Then
    pnlLoading.Visible = True
    pnlQuote1.Visible = False
Else
    pnlLoading.Visible = False
    pnlQuote1.Visible = True
    <Load data from DB and web service>
    <Build page>
    If (<Some Criteria>) Then
        somelink.Disable = True
    End If
End If

JavaScript

if (document.getElementById('pnlQuote1') === null) {
    ob_post.post(null, 'PerformRating', ratingResult);
}

ob_post.post is an obout js function that does a normal postback and then follows up with a call to the server method named by the second param. then followed by the call to a JavaScript method named by the third param. The first parameter is the page to post back to. A value of null posts back to the current page.

The post back is working fine. All methods are called in the correct order. The code that gives me trouble is under the code behind in bold. (somelink.disabled = True does not actually disable the link) Again, if I debug and force the disabling of the link to happen the first time in, it disables. Does anyone know what I might do to get around this?

Thanks, GRB

+3  A: 

Your code example is using the IsCallBack check, while the question text talks about the IsPostback Check. I'd verify that you're using Page.IsPostBack in your code to turn off the links.

Stephen Wrighton