Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Update Panel not refeshing after Callback

Reply
Thread Tools

Update Panel not refeshing after Callback

 
 
John Kotuby
Guest
Posts: n/a
 
      12-03-2008
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


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      12-03-2008
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)


"John Kotuby" wrote:

> 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
>
>
>

 
Reply With Quote
 
 
 
 
John Kotuby
Guest
Posts: n/a
 
      12-04-2008
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...

"bruce barker" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>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)
>
>
> "John Kotuby" wrote:
>
>> 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
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to really disable Java Update check when there is NO "Update" tab in Control Panel? Sven Fischer Java 0 10-22-2012 07:54 AM
Iframe refeshing Source URL every time page is displayed John Kotuby ASP .Net 0 08-18-2008 02:45 PM
Delete a panel inside a panel (2) HS1 Java 4 12-08-2004 02:48 AM
Delete a panel inside a panel HS1 Java 3 12-07-2004 10:50 PM
Email From Forms with asp:panel.(s) Only one panel works? Harry ASP .Net 3 11-10-2003 03:13 AM



Advertisments