Update Panel not refeshing after Callback

J

John Kotuby

Hi guys,
I am using 3rd-party grids in Callback mode. When something in a grid is
changed and saved by the user, the grid performs a callback to run the
server code to save the changes and then refresh the grid/s. That's all
working fine.

However, I have placed a Label control and a table cell inside of an update
panel with UpdateMode set to "Always". I want the Label control to display
an appropriate messsage text according to the current state of the Grids.

Running in debug mode I see that the code that I have placed in
Page_PreRender actually seems to run properly during a Callback from the
grids. However the CallBack is not a postback. Fortunately I rebuild the
Grids data whether a Postback or Not. How can I update the Label dusing a
callback? Can I return the Text I want somehow and then apply it on the
Client side?

Thanks for any help. The code is below.

<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Always" >
<ContentTemplate>
<table id="Table1" style="position: relative" border="0" width="370px"
cellspacing="0" cellpadding="0">
<tr>
<td valign="top" align="center" colspan="2" style="padding: 4px">
<asp:Label ID="lblFeedback" runat="server" CssClass="title14"
ForeColor="#990000" EnableViewState="false"
Text="Select a Category to Work With" />
</td>
</tr>
<tr style="height: 5px">
<td runat="server" id="tdMyErrMsg" colspan="2" align="center" style="color:
red">
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>

Protected Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Me.PreRender
If Page.IsPostBack Then
buildGrid1()
buildGridCats()
End If

If Grid1.Items.Count = 0 And strCodeId = "" Then
Me.lblFeedback.Text = "There are No 'Custom Category Groups'. Please Add
One or More"
ElseIf GridCats.Items.Count = 0 And strCodeId = "" Then
Me.lblFeedback.Text = "There are No 'Custom Categories'. Please Add Some
to Work With"
ElseIf strCodeId = "" Then
Me.lblFeedback.Text = "Select a Custom Category to Work With
(Double-Click)"
End If

End Sub
 
B

bruce barker

a callback is not an update panel postback, and does not return the update
panels html. for an update panel to work, it must do the postback (as this
registers the update panels client routines).

if your gird fire client events, you could force another postback, or do a
webservice call. if you can turn off the grids callback, then you could put
it in an update panel if it is properly coded to work in an update panel.

-- bruce (sqlwork.com)
 
J

John Kotuby

Thanks Bruce,

I appreciate the reply and fogot to thank you yesterday. I am trying to move
away from the Update Panel method for partial page refresh because it sends
to much baggage to the server in the form of ViewState on large complicated
pages. I am just getting the hang of Calbacks and the various ways they are
implemented, as well as how they relate to other ASP.NET controls like the
UpdatePanel (where I haven't gotten around to converting them yet).

I am working on using the Callback_Complete event in the Grids to fire
another callback to refresh just the displayed maessage, which relies on the
contents of the Grids.

Thanks again...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,152
Members
46,697
Latest member
AugustNabo

Latest Threads

Top