-1

When an UpdatePanel Calls a method in server and for example this method change

textBox1.Text = "12312"

and this textBox1 was out of updatePanle scope it dosn't change it text till a postback happend to the page

so I need after that calculation and chaging the Textbox's text in the server, I need to forcepage to do postback

plz can any one help ?

KV Prajapati
  • 93,659
  • 19
  • 148
  • 186
Khaleel Hmoz
  • 987
  • 2
  • 13
  • 24

2 Answers2

5

If you want to force a refresh you could try: Response.Redirect(Request.Url.AbsoluteUri) This should force a redirect to the current page.

Hope this helps

4

If you wish for a control within the UpdatePanel to perform a standard postback, define a PostBackTrigger within the UpdatePanel, setting the ControlID to the ID of the control you wish to perform the postback.

<asp:UpdatePanel ...

     ...

    <Triggers>
        <asp:PostBackTrigger ControlID="ControlIDToPostBack" />
    </Triggers>
</asp:UpdatePanel>

Or you could add the TextBox control you wish to update to another UpdatePanel setting both of the UpdatePanel's UpdateMode properties to Always.

This will ensure that the content within both UpdatePanel controls is updated for all postbacks that originate from the page. Which includes asynchronous postbacks.

<asp:UpdatePanel ... UpdateMode="Always"
jdavies
  • 12,784
  • 3
  • 33
  • 33
  • If the control is within the UpdatePanel, then you can also set the AutoPostBack=true property on the Control. And if the control to trigger is outside the UpdatePanel, you can use PostBackTrigger as you say. – StuartLC Oct 20 '11 at 08:33
  • The first solution will enable you to define a control within the UpdatePanel which will cause a full page postback (which means changes to the TextBox will be reflected after the postback). If this is not an option and you wish to keep the async postback you can use the second solution, but this means you will need to wrap the TextBox in another UpdatePanel, setting the `UpdateMode` as specified in my answer. – jdavies Oct 20 '11 at 10:05