Monday, March 26, 2012

Atlas UpdatePanel

I have several textboxes, a gridview and an image in a panel that need to be updated based upon info entered into a textbox. Everything works like a champ when I don't use the Atlas UpdatePanel, but I can't seem to figure out how to get even one section to work. Initially I had all 3 areas wrapped into the UpdatePanel and now I'm just trying to update some textboxes with info returned from the server. Neither one works. I tried the PostBackTrigger and AsynchPostBackTrigger. Can anyone tell me what I'm doing wrong?

<asp:UpdatePanel ID="up" runat="server" UpdateMode="Conditional" >
<ContentTemplate>

<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td style="width:125px" align="right" class="smalltext"><asp:Label ID="lblAccount" AssociatedControlID="txtAccount" runat="server">Account #: </asp:Label></td>
<td class="smalltext" style="width:175px">
<asp:TextBox ID="txtAccount" OnTextChanged="txtAccount_TextChanged" MaxLength="16" runat="server" CssClass="textbox"></asp:TextBox>
<img src="http://pics.10026.com/?src=Images/merge.gif" style="vertical-align:text-bottom" alt="Grab customer info from CSG" onclick="getCustomerInfo()" />

</td>
<td rowspan="2" style="width:70px">
<asp:Panel runat="server" ID="pnlPrevEntries">
<a href="http://links.10026.com/?link=javascript: void(0)" onclick="overlay('caution', 'PrevEntries', 'right')"><img src='Images/caution.png' id='caution' /></a>
</asp:Panel>
</td>
<td style="text-align:center" valign="top" class="smalltext">
<span id="Fullname"><%=Session("Fullname")%></span><span id="extension" style="display:none"><%=Session("extension") %></span><br /><%=Session("Role")%>
</td>
</tr>
<tr>
<td align="right" class="smalltext"><asp:Label ID="lblName" AssociatedControlID="txtName" runat="server">Name (Last, First): </asp:Label></td>
<td>
<asp:TextBox ID="txtName" MaxLength="100" runat="server" CssClass="textbox"></asp:TextBox><!--<input type="text" ID="txtName" MaxLength="100" Class="textbox">-->
<div id="customerInfo">
<asp:TextBox id="txtAddr1" runat="server"></asp:TextBox>
<asp:TextBox id="txtAddr2" runat="server"></asp:TextBox>
<asp:TextBox id="txtCity" runat="server"></asp:TextBox>
<asp:TextBox id="txtState" runat="server"></asp:TextBox>
<asp:TextBox id="txtZip" runat="server"></asp:TextBox>
<asp:TextBox id="txtPhone" runat="server"></asp:TextBox>
<asp:TextBox id="txtRetentionId" runat="server"></asp:TextBox>
<asp:TextBox ID="txtLobChanged" runat="server"></asp:TextBox>
<asp:TextBox ID="txtComments" runat="server"></asp:TextBox>
<asp:TextBox ID="txtPkgID" runat="server"></asp:TextBox>
<asp:TextBox ID="txtReasons" runat="server"></asp:TextBox>
<asp:TextBox ID="txtUncontrollable" runat="server"></asp:TextBox>
<asp:TextBox ID="txtTechProbs" runat="server"></asp:TextBox>
<asp:TextBox ID="txtComps" runat="server"></asp:TextBox>
</div>
</td>
</tr>
</table>
<!-- GridView for previous entries -->
<div id="PrevEntries">
<asp:GridView ID="grdPrevEntries" runat="server"
DataKeyNames="retentionId"
AutoGenerateColumns="False"
CssClass="smGridview"
GridLines="both"
CellPadding="3">
<Columns>
<asp:TemplateField >
<ItemTemplate>
<a href="http://links.10026.com/?link=http://forums.asp.net/AddPost.aspx?ForumID=1007#" id="<%# Eval("retentionId") %>" onclick="selectPrevEntry('<%# Eval("retentionId") %>')">SELECT</a>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="tDate" HeaderText="DATE" DataFormatString="{0:MM/dd/yy}" HtmlEncode="False" />
<asp:BoundField DataField="lob" HeaderText="LOB" />
<asp:BoundField DataField="subreq" HeaderText="SUBREQ" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="reason" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="inPkg" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="outPkg" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="offer" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
<asp:BoundField DataField="comments" ControlStyle-CssClass="hidden" ItemStyle-CssClass="hidden" HeaderStyle-CssClass="hidden" FooterStyle-CssClass="hidden" />
</Columns>

</asp:GridView>
<p style="text-align:right; margin:20px 3px 3px 0"><a href="http://links.10026.com/?link="#" onclick="overlayclose('PrevEntries');return false"> CLOSE</a></p>
</div> </ContentTemplate>
<Triggers><asp:AsyncPostBackTrigger
<asp:PostBackTrigger ControlID="txtAccount" />

</Triggers>

</asp:UpdatePanel>
<asp:UpdateProgress runat="server" ID="prgPrevEntries">
<ProgressTemplate>
<img src="http://pics.10026.com/?src=Images/xsmloading.gif" alt="Loading" />
</ProgressTemplate>
</asp:UpdateProgress>


One simple thing I can see is that you don't need the triggers since the textbox that's firing the event is actually in the UpdatePanel (you don't need the triggers section at all... triggers are used mainly to handle situations where you want an external control's postback to cause Ajax Postbacks.

Use of javascript is sometimes something to worry about (but usually things fail with javascript that is simply written to the form to execute inline (and not attached to an event)... I don't see anything like that, so my guess is the triggers section.


BTW, you do have a ScriptManager on the form, right? That's the most common error... ScriptManager with EnablePartialRendering="true" it should look like this

<asp:ScriptManager id="sm1" runat="server" EnablePartialRendering="true" />

Jay Kimble
-- The Dev Theologian
-- http://codebetter.com/blogs/jay.kimble/

No comments:

Post a Comment