Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Forcing postback through an update panel

Posted on 2011-03-08
2
Medium Priority
?
326 Views
Last Modified: 2012-05-11
I have a web form (asp.net front, c# back) which has two pages. The first page is a dashboard of sorts which provides the user with a queue of records drawn from the database. I have a "next" button which automatically goes to the next record in the queue, and launches a new window with certain variables in it to configure the second page.

Problem is, I recently modified the dashboard page to use update panels, and partial postbacks, so that the page isnt reloading everytime someone changes a setting or what have you.

So the script that actually launches the new window is triggered via javascript on the loading of the page window. Since this page is now in an update panel, I believe when the next button is hit, the next record is "loaded" and the URL for the new window launch is available, but the javascript that launches the windows isnt firing, because technically the page isnt reloading.

Can someone help me figure out a solution to this?

Here is the javascript at the beginning of the page:

function window_onload() {

        if (window.name != "WTMAIN") {
            window.open("main.aspx", "WTMAIN", "", false);
            window.open("", "_self", "", false);
            window.opener = top;
            window.close();
        }
        window.top;
        window.moveTo(0, 0);
        window.resizeTo(screen.width, screen.height);

        if (form1["HFUrl"].value.length > 0) {
            window.open(form1["HFUrl"].value, "CRM", "", false);
            form1["HFUrl"].value = "";
        }
    }

Once the next button is pushed, the "HFUrl" (simply a hidden field which tells the app WHICH page to launch) is populated with the page and the variables needed. Before the update panel was put in, it would reload the page and launch the window.

One way I KNOW would fix this, would be to remove the overall update panel on the form, and replace it with separate update panels around all the different elements that need them, and this would leave certain other elements that DONT need them (like the next button) automatically posting back the page like they used to.... I'm trying to avoid doing this if possible.

Thanks!
0
Comment
Question by:nuvium
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 3

Expert Comment

by:kolakanuru1
ID: 35073825
Did you try calling window_onload function in the clientclick event of the next button?
0
 
LVL 15

Accepted Solution

by:
rajeeshmca earned 2000 total points
ID: 35078989
Hi,

U could instead use triggers with update panel....

<asp:UpdatePanel ID="updatePnl" runat="server" UpdateMode=Conditional>
            <ContentTemplate>
             
                <asp:GridView ID="gridViewPersons" runat="server"
                AutoGenerateColumns="False" CellPadding="4" ForeColor="#333333"
                GridLines="None" Width="460px">
                </asp:GridView>
               <asp:button ID ="triggerbutton" runat="server" Text="Trigger" />
                   
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="triggerbutton" />
            </Triggers>

        </asp:UpdatePanel>
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Introduction This article shows how to use the open source plupload control to upload multiple images. The images are resized on the client side before uploading and the upload is done in chunks. Background I had to provide a way for user…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

715 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