?
Solved

Update panel freezes the page

Posted on 2010-04-07
13
Medium Priority
?
1,576 Views
Last Modified: 2012-05-09
I have a web page with two update panel controls (search and search result). The button search onclick event just gets new data table based on the search criteria and binds to the gridview control. The page works as expected (first or second time) but after a few trys, it just freezes. I debug the app and onclick event to the end of the sub and it works fine (new data table created and bound to the gridview)  but when I press F5 to continue, the whole page just freezes. Not sure what to check for next???

    <asp:UpdatePanel ID="upSearchFilters" runat="server">
        <ContentTemplate>
            <asp:TextBox ID="txtStructureID" runat="server"></asp:TextBox>
            <asp:Button ID="btnSearch" runat="server" Text="Search" OnClick="btnSearch_Click" />
        </ContentTemplate>
    </asp:UpdatePanel>
    <asp:UpdatePanel ID="upSearchResults" runat="server" >
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnSearch" EventName="Click" />
        </Triggers>        
      <ContentTemplate>
            <asp:Panel ID="pnlSearchResults" runat="server" CssClass="gridsearch">
                <asp:GridView ID="gvSearchResults" runat="server" CellPadding="3" AutoGenerateColumns="False">
                    <Columns>
                        <asp:TemplateField HeaderText="Bridge Name" SortExpression="grid_Bridge_Name">
                            <HeaderStyle Wrap="False" />
                            <ItemTemplate>
                                <asp:Label ID="lblgrid_Bridge_Name" runat="server" Text='<%# Bind("grid_Bridge_Name") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                  .....more template fields

                    </Columns>                  

                    <FooterStyle BackColor="#006633" Font-Bold="True" ForeColor="White" />
                    <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
                    <EditRowStyle BackColor="#999999" />
                    <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
                    <PagerStyle BackColor="#006633" ForeColor="White" HorizontalAlign="Center" />
                    <HeaderStyle  BackColor="#006633" Font-Bold="True" ForeColor="White" HorizontalAlign="Left" />
                    <AlternatingRowStyle BackColor="Gainsboro" ForeColor="#006633" />
                   
                </asp:GridView>
            </asp:Panel>      
        </ContentTemplate>
    </asp:UpdatePanel>
0
Comment
Question by:xyzlucky
  • 6
  • 5
12 Comments
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 30071370
I have asked to have this Question to be Re-Zoned, as this is a .NET Application not ASP Classic.

For Future Reference, when dealing with ASP.NET Questions, please assign them to zone:
http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/

Good Luck
Carrzkiss
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 30116949
when the page "freese" do you get a error?
When you are using update panels, sometime the error is shown an the bottum of the page as a yellow exclamation mark.
you could also tempararly change the AsyncPostBackTrigger to a PostBackTrigger to see what really happen.
When you hit the breackpoint, you could also try to hit F11 instead of F5 to see if any other code is executed.
you aspx code look good, so i suspect the problem is on the server side code. coul you provide some?
 
0
 

Author Comment

by:xyzlucky
ID: 30125638
I did hit F11 and it just did not get anywhere, just the hourglass and nothing else no error. here is the server code, the records return from the seach is correct and everything runs fine until the end of
RefreshSearchResults();


    protected void btnSearch_Click(object sender, EventArgs e)
    {
        this.btnSearch.Focus();
        this.Search.StructureID = this.txtStructureID.Text;
        this.Search.BridgeNumber = this.txtBridgeNo.Text;
        this.Search.ContractNumber = this.txtContractNo.Text;
        this.Search.CountyName = this.txtCounty.Text;
        this.Search.Route1 = this.txtRoute1.Text;
        this.Search.Route2 = this.txtRoute2.Text;
        this.Search.IsShowOnRoutesSpecified = this.chkRouteSpecified.Checked;
        this.Search.MilePost1 = 0;
        this.Search.MilePost2 = 0;

        if (!string.IsNullOrEmpty(this.txtMilepostRangeFrom.Text))
           this.Search.MilePost1 = Convert.ToDecimal(this.txtMilepostRangeFrom.Text);
        if (!string.IsNullOrEmpty(this.txtMilepostRangeTo.Text))
            this.Search.MilePost2 = Convert.ToDecimal(this.txtMilepostRangeTo.Text);

        this.SetSession(m_strSessionSearchResult, new DataView(this.Data.GetSearchResult(this.Search)));

        RefreshSearchResults();
    }

    protected void RefreshSearchResults()
    {
        DataView dv = this.GetSession<DataView>(m_strSessionSearchResult);
        if (dv.Table.Rows.Count == 1)
        {
            this.Response.Redirect("CurrentBridge_Info.aspx?id=" + dv.Table.Rows[0][0].ToString());
        }
        else
        {
            this.gvSearchResults.DataSource = dv;
            this.gvSearchResults.DataBind();
        }

        if (dv.Table.Rows.Count == 0)
        {
            this.lblError.Text = "*** No structures found that match criteria ***";
            this.lblTotalRecord.Text = "";
        }
        else
        {
            this.lblError.Text = "";
            this.lblTotalRecord.Text = "Number of Bridges: " + dv.Table.Rows.Count.ToString();
        }

    }
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 

Author Comment

by:xyzlucky
ID: 30130140
I did change the AsycPostBackTrigger to PostBackTrigger and everything works fine (except it does the whole page refresh which I don't want)..
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 30130307
Then if it work with a PostBackTrigger, could you try it using only one (big) updatepanel instead of two?
0
 

Author Comment

by:xyzlucky
ID: 30133166
I just tried using one big updatepanel and same result., it works all the time with PostBackTrigger and refresh page but works only first try if I use AyncPostBackTrigger.
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 30133829
This look like a complex problem. Since it work with the PostBackTrigger and not with the AyncPostBackTrigger, I suspect something to loose sync. ther is anything that is outside the update panels? ther is thing like "lblError" that i dont find on the ASPX you sent...
 
0
 

Author Comment

by:xyzlucky
ID: 30139291
I did not want to make the text so long but lblError is just part of the UpdatePanel

    <asp:UpdateProgress ID="progSearchResults" runat="server" AssociatedUpdatePanelID="upSearchFilters">
        <ProgressTemplate>
            <center style="font-size: medium; color: #FF0000; font-weight: bold;"><img src="images/icons/spinner.gif" alt="" />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Searching...</center>
        </ProgressTemplate>
    </asp:UpdateProgress>
           
    <asp:UpdatePanel ID="upSearchResults" runat="server">
        <Triggers>
            <asp:PostBackTrigger ControlID="btnSearch"  />
        </Triggers>
        <ContentTemplate>

            <asp:Label ID="lblTotalRecord" style="color:black; font-size:small;" runat="server"></asp:Label>
            <asp:Label ID="lblError" style="color:#FF0000; font-size:medium;" runat="server"></asp:Label>
            <asp:Panel ID="pnlSearchResults" runat="server" CssClass="gridsearch">
                <asp:GridView ID="gvSearchResults" runat="server" CellPadding="3" AutoGenerateColumns="False">
                    <Columns>
                        <asp:TemplateField HeaderText="GUID" SortExpression="key_control_entity_gid" Visible="False">
                            <HeaderStyle Wrap="False" />
0
 
LVL 18

Expert Comment

by:David Robitaille
ID: 30139827
well, it was just the i did not find it, I just want to be sure that there is nothing that is sent to the client that is not updated.
While we are there, what is that this.Search object?
this.Search.StructureID = this.txtStructureID.Text;
        this.Search.BridgeNumber = this.txtBridgeNo.Text;
        this.Search.ContractNumber = this.txtContractNo.Text;
        this.Search.CountyName = this.txtCounty.Text;
        this.Search.Route1 = this.txtRoute1.Text;
        this.Search.Route2 = this.txtRoute2.Text;
        this.Search.IsShowOnRoutesSpecified = this.chkRouteSpecified.Checked;
        this.Search.MilePost1 = 0;
        this.Search.MilePost2 = 0;
 
is that something that is stored on the page??
Anyway, i`m guessing there, the important thing is that everything that is updated must be inside update panels.
0
 

Author Comment

by:xyzlucky
ID: 30140121
oSearch is the Search object (completely on server side) that contains all search criteria to be pssed to the SetSession to get data from the database; and yes lblTotalRecord,lblError,and gvSearchResult are the ones that need update.
0
 
LVL 18

Accepted Solution

by:
David Robitaille earned 2000 total points
ID: 30140721
Search object (completely on server side)
well, it`s what you think...
I`m not sure it appen the way you think. Try setting that object locally (into the function) and pass it as a parameter on need. you could also make function to set them and retrive them from the session variable.
With the infomration you gave me, it<s the only thing i could see to screw thing.
0
 

Author Comment

by:xyzlucky
ID: 30141435
I see what you mean. I'll try your suggestion and let you know. THANKS..
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As with any other System Center product, the installation for the Authoring Tool can be quite a pain sometimes. This article serves to help you avoid making these mistakes and hopefully save you a ton of time on troubleshooting :)  Step 1: Make sur…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
Viewers will learn the different options available in the Backstage view in Excel 2013.
The viewer will learn how to create a normally distributed random variable in Excel, use a normal distribution to simulate the return on an investment over a period of years, Create a Monte Carlo simulation using a normal random variable, and calcul…

601 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question