Ayende @ Rahien

Hi!
My name is Oren Eini
Founder of Hibernating Rhinos LTD and RavenDB.
You can reach me by phone or email:

ayende@ayende.com

+972 52-548-6969

, @ Q c

Posts: 6,124 | Comments: 45,470

filter by tags archive

Comments

Justin-Josef Angel [MVP]

Then you should probably use the UpdatePanel.Update client-side Method :)

http://ajax.asp.net/docs/mref/MSystemWeb_UIUpdatePanelUpdate.aspx

Ayende Rahien

@Justin,

You pointed me at the SERVER reference, I need it from CLIENT.

What I am looking for is something like this:

<form id="form1" runat="server">

    <asp:ScriptManager ID="ScriptManager1" runat="server" />

<div>

Last Postback: <%=System.DateTime.Now %>

<asp:UpdatePanel ID="UP1" runat="server">

    <ContentTemplate>

        Last Update: <%=System.DateTime.Now %>

    </ContentTemplate>

</asp:UpdatePanel>

<input type="button" onclick="$get('UP1').Update(); return false;" />

</div>

</form>

scottgu

UpdatePanels update when a control inside them does a post-back, or when a control that is associated with the updatepanel via a trigger does a postback.

h

So for example, if your button was inside the updatepanel, and you wanted to cause it to postback, you'd just write this JavaScript:

$get('<%=MyButton.ClickId %>').click();

This will cause the button to fire, and the updatepanel it was in (or associated with via a trigger) would update.

Thanks,

Scott

Justin-Josef Angel [MVP]

You can use the server-side ScriptManager.RegisterAsyncPostBackControl so any control event will make the updatepanel refresh.

http://ajax.asp.net/docs/mref/MSystemWebUIScriptManagerRegisterAsyncPostBackControl1_62fe17e7.aspx

or (and you didn't here this from me) look at the Javascript code RegisterAsyncPostBackControl produces and use the Sys.WebForms.PageRequestManager.getInstance()._updateControls client-side method.

Naturelly, you should never use javascript private methods. But you can :-)

Ayende Rahien

@Justin,

I need to make a decision on the client side if I would update the panel or not, it is not just clicking on a control and being done with it.

I would hope to avoid using the private methods.

I am already forced to do this for updating cascading drop down from code.

Ayende Rahien

@Scott,

Yes, I know that, but in this case, I have several panels that contains information, the user is updating a record, which should cause all the other updates to be refreshed. I can't register a control as a post back trigger, because the refresh is depending on the input from the user.

The use case for an update panel in this case is: "I want to update this particular section of the page with information."

In this case, there isn't any way to do this short of faking a postback that the update panel will catch. This seems unnatural to me, because there isn't anything there that should be clicked.

Comment preview

Comments have been closed on this topic.

FUTURE POSTS

  1. RavenDB 3.5 whirl wind tour: You want all the data, you can’t handle all the data - 2 days from now
  2. The design of RavenDB 4.0: Making Lucene reliable - 3 days from now
  3. RavenDB 3.5 whirl wind tour: I’ll find who is taking my I/O bandwidth and they SHALL pay - 4 days from now
  4. The design of RavenDB 4.0: Physically segregating collections - 5 days from now
  5. RavenDB 3.5 Whirlwind tour: I need to be free to explore my data - 6 days from now

And 14 more posts are pending...

There are posts all the way to May 30, 2016

RECENT SERIES

  1. RavenDB 3.5 whirl wind tour (14):
    29 Apr 2016 - A large cluster goes into a bar and order N^2 drinks
  2. The design of RavenDB 4.0 (13):
    28 Apr 2016 - The implications of the blittable format
  3. Tasks for the new comer (2):
    15 Apr 2016 - Quartz.NET with RavenDB
  4. Code through the looking glass (5):
    18 Mar 2016 - And a linear search to rule them
  5. Find the bug (8):
    29 Feb 2016 - When you can't rely on your own identity
View all series

RECENT COMMENTS

Syndication

Main feed Feed Stats
Comments feed   Comments Feed Stats