Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / July 2007

Tip: Looking for answers? Try searching our database.

why does updating a div inside of an updatepanel still refreshes entire page?!?!!

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jojoba@gmail.com - 03 Jul 2007 17:52 GMT
hi everyone!
i'm serving up an asp.net page using ajax futures.

long story short:
i have two update panels.
one has a webpage in it (e.g. www.google.com).
the other has an image inside of a div.
however, when i update the div in code behind ( via
UpdatePanel_div.Update() ), the entire page refreshes.
if i change the div to an iframe, then the entire page does not
refresh, only the iframe (like i want).
im not sure what's going on here....is there something special about
div's?
thanks to anyone who has some ideas on this one.
btw...please let me know if you need more info.
thanks,
jojoba
GroupReader - 03 Jul 2007 18:20 GMT
When you call UpdatePanel_div.Update( ) from the code-behind, you are
already in the middle of a postback, right?  What's the trigger
(control) that caused the postback?  Try putting that control inside
an updatePanel also (with children as triggers false and update
conditional).  OR try just declaring that control as a "trigger" for
your UpdatePanel_div.
matthew.sibigtroth@gmail.com - 03 Jul 2007 18:33 GMT
hi and thx for the help!

you said:
<<<<
What's the trigger (control) that caused the postback?  Try putting
that control inside an updatePanel also (with children as triggers
false and update conditional).  OR try just declaring that control as
a "trigger" for your UpdatePanel_div.

The control is a Standard Button.
This button is in the same UpdatePanel (UpdatePanel_remoteWebPage)
that contains a webpage inside (e.g. www.google.com), .
The button is a trigger ONLY for the UpdatePanel_div.
So i have tried your second suggestion to no avail <sad face>.
And i just tried your second suggestion to no avail (putting the
"trigger" button into its own update panel, and setting the trigger
params) <sadder face>
Perhaps this is a bug?
Is the div maybe covering the whole screen or something....and that's
why im getting the full refresh...(i have set the size of the div tho
to be like 100 x 100)

Any other avenues perhaps?
Thx again,
jojoba
Patrice - 03 Jul 2007 18:43 GMT
Add perhaps a visible border around your updatepanel as well as a date
outside of the updatepanel.

It would confirm wether or not you are seeing a full refresh or if it
refresh just the needed part but of course if this part contains a lot of
things all those things are refreshed making you think the whole page is
refreshed...

Also you could test in a bare bone page to see if it works as expected :
- either it works and you could find by adding something more similar to
your final code what is the final culprit
- or you'll have a bare bone sample that shows the problem to submit so that
we can see easily (please keep the sample to the minimal amount of code that
shows the problem) see how you are doing the update

--
Patrice

> hi and thx for the help!
>
[quoted text clipped - 21 lines]
> Thx again,
> jojoba
matthew.sibigtroth@gmail.com - 03 Jul 2007 19:02 GMT
Thanks Patrice!

Tried your suggestion to better localize the issue.
I put a label outside of the UpdatePanels.
I set its text in code-behind, right before i update the
UpdatePanel_div, and the text does NOT change in the browser.
This means to me that although the entire page appears to flicker, i
am still only updating the UpdatePanel_div (that's good!)
So then, the question now is, why the heck is the entire page
flickering when we have just shown that ONLY the UpdatePanel_div is
updating?
Thnx to all,
jojoba
matthew.sibigtroth@gmail.com - 03 Jul 2007 20:54 GMT
still stuck...
please...anyone have any thoughts?
thx so much
matt
GroupReader - 03 Jul 2007 22:48 GMT
Your said you were calling the updatePanel's update() method
explicitly  *and* you have a button as a trigger.  That's not how I do
it.

I do one of the following:

A)  set a control as a trigger for your update panel.  Then you don't
need to call "update()" yourself in the codebehind.  I think this is
how it works normally, out-of-the-box.

B)  Here's what I like best:  Create updatePanels anywhere on your
page you want.  Make sure they are all "conditional" and make sure you
DO NOT define any triggers.  Make sure children as triggers is false.
Then, in the code-behind, call UpdatePanel.Update() method to tell
asp.net to refresh only the proper updatePanel and not the rest of the
page whenever you want.  This seems to work really well.

To answer one of your original questions:  there is definitely nothing
special about a div that would mess up the updatePanel.

My question:  I don't really understant what you mean by "one of the
updatePanels has a webpage in it"?  What, technically speaking, does
that mean?  Are you using an IFrame?  Are you fetching html from a
page and inserting it into a div for it to be rendered?
jojoba@gmail.com - 03 Jul 2007 23:16 GMT
Hi again

GroupReader said:

>Here's what I like best:  Create updatePanels anywhere on your
>page you want.  Make sure they are all "conditional" and make sure you
>DO NOT define any triggers.  Make sure children as triggers is false.
>Then, in the code-behind, call UpdatePanel.Update() method to tell
>asp.net to refresh only the proper updatePanel and not the rest of the
>page whenever you want.  This seems to work really well.

That's sounds like great advice (why update twice, right?).
I implemented those changes.....Still got that darn update problem
(arg!)

GroupReader said:
> My question:  I don't really understant what you mean by "one of the
> updatePanels has a webpage in it"?  What, technically speaking, does
> that mean?  Are you using an IFrame?  Are you fetching html from a
> page and inserting it into a div for it to be rendered?

Yep, i am using a dynamically generated iframe:
Frame = HtmlGenericControl('iframe')
Then i point the src attribute to whatever url i want:
Frame.Attributes.Add("src", "http://www.google.com")
That works great.
What stinks is that when i overlay a div on the iframe, and then tell
the UpdatePanel containing the div to update, the whole page flashes.

Kinda confusing....especially since if i change the div to an iframe,
i do not get an flash across the entire page....the update works as
expected

any thoughts.
thx again,
jojoba

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.