CodeVerge.Net Beta


   Item Entry   Register  Login  
Microsoft News
Asp.Net Forums
IBM Software
Borland Forums
Adobe Forums
Novell Forums



Zone: > Asp.Net Forum > asp.net_ajax.asp.net_ajax_ui Tags:
Item Type: Date Entered: 1/8/2008 3:59:39 AM Date Modified: Subscribers: 0 Subscribe Alert
Rate It:
NR
XPoints: N/A Replies: 9 Views: 3067 Favorited: 0 Favorite
Can Reply:  No Members Can Edit: No Online: Yes
10 Items, 1 Pages |< << Go >> >|
"robertmazzo" <
NewsGroup User
Issue with Repeater control inside an UpdatePanel11/29/2007 3:38:45 PM

0

I have an asp.net 2.0 Repeater control inside an Ajax UpdatePanel. I actually have everything technically working; however, there is one major issue I cannot figure out.
Why do all my page controls (links, dropdowns, etc.) freeze up during the asynch callback ?

The following items I explain below come from my Orders.aspx page, which is attached to a master page. The master page does NOT have a timer; it only has a Script Mngr specified in order for me to display/hide my update image which shows everytime the Timer kicks off.

Orders.aspx:
First, I have a Timer control set to fire at Interval="15000" (15 secs). Then I have an UpdatePanel control below with UpdateMode="Conditional".
Now within the UpdatePanel control I have a <ContentTemplate>, and within that I have the <Repeater> control.

On the server-side On_Load() event I instantiate a new PagedDataSource object for page nav - I set it to 50 orders per page. Page Nav works just fine.

I have tested and tested to figure out why my controls all freeze up during the asynch postback, but I can't come up with anything. I cannot release this to the client this way.

I would greatly appreciate some feedback .

sincerely,
Bob

"robertmazzo" <
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel12/4/2007 5:32:03 PM

-2

Would someone please provide some feedback. Perhaps someone from the MS team ?

Thank you.

Bob 

"DisturbedBuddh
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel12/4/2007 6:05:11 PM

0

Can u post your code?

 


When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.


My latest ASP.NET AJAX blog entries.
"robertmazzo" <
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel12/4/2007 8:37:04 PM

0

I am editing the previous post where I had pasted in a long aspx page. Here is a brand new aspx page I started from scratch. It contains an ajax script manager, timer, update panel, triggers and finally the repeater. There is a very simple sql select statement embedded in the page. No code-behind and no dal code.

I am STILL experiencing intermittent problems getting focus on each dropdown list and hyperlink. I can focus on it but only for a second or two; when the timer fires, the dropdown loses focus and re-initializes.

 In other words, if I am viewing the dropdown items "item test1', etc. then it loses focus as soon as the timer fires. I then have to re-click to view the dropdown items.

Please review my aspx code:

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title> </head>

<body>

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

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

</asp:ScriptManager>

<asp:Timer ID="TimerOrders" runat="server" Interval="2000" />

 

<div style="font-family:Book Antiqua; font-size: large; font-weight: bolder; font-style: oblique; position: relative; visibility: visible; overflow: scroll" >

Testing Ajax stuff !!

Bob the developer.

</div>

<br />

<asp:updatepanel ID="Updatepanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" >

<ContentTemplate>

 

<table border="1" cellpadding="0" cellspacing="0" width="100%" >

<tr align="center">

<td style="height: 121px; font-family: 'Times New Roman';">

<table border="0" cellspacing="0" width="100%">

<tr>

<td>

 

 

<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" Visible="true">

 

<HeaderTemplate>

Ticket Number&nbsp;&nbsp;Currency&nbsp;&nbsp

</HeaderTemplate>

<ItemTemplate> <tr align="center" id="trTagOrder" style="font:Arial; font-weight:bold; font-variant:normal; color:Black;" runat="server" >

<td style="text-align:left;width:80px;"><asp:Label ID="lblCur1" Text='<%#Eval("cur_1") %>' runat="server" /></td>

<td style="text-align:left;width:80px;"><asp:Label ID="Label1" Text='<%#Eval("cur_2") %>' runat="server" /></td>

<td id="tdBuySell" style="text-align:center;width:20px; padding-left:3px;"><asp:Label ID="lblBuySell" Text='<% #Eval("buy_sell") %>' runat="server" ></asp:Label></td>

<td id="tdAmount" style="text-align:center;width:85px"><asp:Label ID="lblAmount" Text='<%# String.Format("{0:#,###,###}", Eval("amount") ) %>' runat="server" ></asp:Label></td>

<td style="text-align:left; width:40px" ><asp:Label ID="lblTradedCur" Text='<%# Eval("act_cur").ToString()=="1" ? Eval("cur_1") : Eval("cur_2") %>' runat="server" /></td>

<td style="text-align:left;width:65px"><asp:Label ID="lblRateStr" Text='<% #Eval("rate_str") %>' runat="server" /></td>

<td style="text-align:left;width:35px; padding-left:3px"><asp:Label ID="lblOrdType" Text='<% #Eval("order_type") %>' runat="server" /></td>

 

<td style="text-align:left;" ><asp:HyperLink ID="hypTicket" Text='<%#Eval("ticket") %>' runat="server" NavigateUrl="http://www.google.com"></asp:HyperLink> </td>

<td style="text-align:left;">

<asp:DropDownList runat="server" ID="drpList1" >

<asp:ListItem Selected="True" Text="Test Item1" Value="1"></asp:ListItem>

<asp:ListItem Text="Test Item2" Value="2"></asp:ListItem>

<asp:ListItem Text="Test Item3" Value="3"></asp:ListItem>

</asp:DropDownList>

</td>

</tr>

</ItemTemplate>

 

<FooterTemplate><br /><br />All Done!</FooterTemplate>

</asp:Repeater>

 

</td>

</tr>

</table>

</td>

</tr>

</table>

</ContentTemplate>

 

<Triggers>

<asp:AsyncPostBackTrigger ControlID="TimerOrders" />

</Triggers>

</asp:updatepanel>

 

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:orderfx1202ConnectionString %>"

SelectCommand="SELECT [ticket],[cur_1], [cur_2], [buy_sell], [amount], [amt_unit], rate_str, [act_cur], [fx_spot], [ord_stat], order_type, [tick_lnk1], [tick_lnk2], [client], [buy_amt], [sell_amt], [memo] FROM [order_fx] ORDER BY [ticket], [cur_1], [cur_2]">

<SelectParameters>

 

</SelectParameters>

</asp:SqlDataSource>

 

 

 

</form>

</body>

</html>

 

 

 

"Jin-Yu Yin - M
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel12/11/2007 3:41:41 AM

0

Hi,

Give you a sample:

<%@ Page Language="C#" MasterPageFile="~/MasterPage_OrdersConsole.master" AutoEventWireup="true"
    CodeFile="orders.aspx.cs" Inherits="orders" Title="FxOrderView Console" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
                <HeaderTemplate>
                    <table border="1" cellpadding="0" cellspacing="0" width="100%">
                        <tr align="center">
                            <td style="height: 121px; font-family: 'Times New Roman';">
                                <table border="0" cellspacing="0" width="100%">
                </HeaderTemplate>
                <ItemTemplate>
                    <tr>
                        <td>
                            <%# Eval("QueueName")%>
                        </td>
                    </tr>
                </ItemTemplate>
                <FooterTemplate>
                    </table></td></tr></table>
                </FooterTemplate>
            </asp:Repeater>
            <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AspNetForumReportToolConnectionString %>"
                SelectCommand="SELECT [QueueName] FROM [AFQueues]"></asp:SqlDataSource>
        </ContentTemplate>
        <Triggers>
        <asp:AsyncPostBackTrigger ControlID="Timer1" />
        </Triggers>
    </asp:UpdatePanel>
    <asp:Timer ID="Timer1" runat="server" Interval="5000">
    </asp:Timer>
</asp:Content>

You have error in you code:

<table border="1" cellpadding="0" cellspacing="0" width="100%" >
  <tr align="center">
    <td style="height: 121px; font-family: 'Times New Roman';">
    <table border="0" cellspacing="0" width="100%">
    <tr>
    <td>

    <asp:Repeater ID="Repeater1" runat="server" OnDataBinding="Repeater1_DataBinding" OnItemDataBound="Repeater1_ItemDataBound" OnPreRender="Repeater1_PreRender" >
    <HeaderTemplate>
        <tr style="background-color:#E0E0E0;" id="trHeaders" runat="server" >
 

Should be:

<table border="1" cellpadding="0" cellspacing="0" width="100%" >
  <tr align="center">
    <td style="height: 121px; font-family: 'Times New Roman';">
    <table border="0" cellspacing="0" width="100%">

    <asp:Repeater ID="Repeater1" runat="server" OnDataBinding="Repeater1_DataBinding" OnItemDataBound="Repeater1_ItemDataBound" OnPreRender="Repeater1_PreRender" >
    <HeaderTemplate>
        <tr style="background-color:#E0E0E0;" id="trHeaders" runat="server" >

or:


    <asp:Repeater ID="Repeater1" runat="server" OnDataBinding="Repeater1_DataBinding" OnItemDataBound="Repeater1_ItemDataBound" OnPreRender="Repeater1_PreRender" >
    <HeaderTemplate>
<table border="1" cellpadding="0" cellspacing="0" width="100%" >
  <tr align="center">
    <td style="height: 121px; font-family: 'Times New Roman';">
    <table border="0" cellspacing="0" width="100%">
<tr style="background-color:#E0E0E0;" id="trHeaders" runat="server" >

Regards,
 


Sincerely,
Jin-Yu Yin
Microsoft Online Community Support
"AMulroy" <>
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel12/27/2007 5:45:59 PM

0

I'm also having a problem with a Repeater nested within an UpdatePanel.  This doesn't occur everytime, but sometimes one or more TextBoxes within my Repeater have trouble getting focus.  The user cannot click in them to give them focus, the user must tab to them.  Typically, it is one or two of the inner TextBoxes....very rarely the first or last TextBox.

I've posted to a forum about this before (can't remember which forum), someone had suggested that I remove the AlternateItemTemplate and only use an ItemTemplate.  I made this change, however, the problem persists.

Here is a code snippet:

1    <ajax:UpdatePanel ID="MainUpdatePanel" runat="server" ChildrenAsTriggers="true" UpdateMode="Always">
2     <ContentTemplate>
3    <table class="OuterTable">
4     <tr><td><uc1:PageTitle ID="TestingPageTitle" runat="server" /></td></tr>
5     <tr><td> </td></tr>
6     <tr><td><asp:Label ID="FailureMsg" runat="server" CssClass="Error"></asp:Label></td></tr>
7     <tr><td><asp:Panel ID="ErrorPanel" runat="server">
8              [omitted: not related to this issue]
9             </asp:Panel>
10            <asp:Panel ID="CredentialsPanel" runat="server" Width="100%">
11             [omitted: not related to this issue]
12            </asp:Panel>
13            <asp:Panel ID="InstructionPanel" runat="server" Width="100%">
14             [omitted: not related to this issue]
15            </asp:Panel>
16            <asp:Panel ID="QuizPanel" runat="server"  Width="100%">
17             <table class="InnerTable">
18              <tr><td><asp:ValidationSummary ID="QuizValidationSummary" runat="server" CssClass="ValidationSummary" ValidationGroup="ResultValidation" /><asp:Label ID="Message" runat="server" CssClass="Error"></asp:Label></td></tr>
19              <tr><td> </td></tr>
20              <tr><td><span class="Subtitle">Instruction:</span> <asp:Label ID="ViewInstruction" runat="server"></asp:Label></td></tr>
21              <tr><td><hr /></td></tr>
22   	   <tr><td><asp:Repeater ID="Questions" runat="server">
23   		     <ItemTemplate>
24   			<table border="0" cellpadding="3" cellspacing="1" width="800">
25   			  <tr><td class="Subtitle" style="text-align: left; vertical-align: top; width: 250px;"><asp:Label ID="Label2" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.Question") %>'></asp:Label></td>
26   			      <td style="text-align: left; vertical-align: top; width: 550px;"><asp:TextBox ID="TextBox2" runat="server" Enabled="true" Width="200"></asp:TextBox></td></tr>
27   			</table>
28   		     </ItemTemplate>
29                      </asp:Repeater></td></tr>
30              <tr><td style="text-align: right"><asp:Button ID="SubmitBtn" runat="server" Text="Continue" CausesValidation="True" ValidationGroup="ResultValidation" OnClick="SubmitBtn_Click" /></td></tr>
31             </table>
32            </asp:Panel>
33            <asp:Panel ID="ServerSideResultPanel" runat="server"  Width="100%">
34             [omitted: not related to this issue]
35            </asp:Panel></td></tr>
36   </table>
37   </ContentTemplate>
38   </ajax:UpdatePanel>

 

Any advice would be greatly appreciated.  Thank you in advance for your help.

"robertmazzo" <
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel12/28/2007 3:57:31 PM

0

The gentlemen above believes I have an html code error right after my initial <table> tag, but that's not an error actually. It's just a table formatting style in order to properly display my repeater templates. This code has been running in a non-ajax production environment for well over a year.

However, I will try his suggestion regardless.

I also tried some code from scratch and still have issue getting focus on my inner dropdown lists. It sounds similiar to Mr. AMulroy's issue.

I just posted my new code I built from scratch ... Please see the forth post above (dated12-04-2007, 3:37 PM) .

Bob

"Jin-Yu Yin - M
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel1/3/2008 4:38:39 AM

0

Hi,

I have tested it for you using the following code, everything works well. 

And I hava something to tell you:

If you do some change with the controls which are in the updatepanle that is updating. The change will be changed back when the Ayncpostback is returned.because when the Ayncpostback is returned back,AJAX replace the whole content of the updatepanel with the content from the server.

<%@ Page Language="C#" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Untitled Page</title>

    <script runat="server">

        protected void TimerOrders_Tick(object sender, EventArgs e)
        {
            TestServerSideControl.Text = DateTime.Now.ToString();
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:Timer ID="TimerOrders" runat="server" Interval="2000" OnTick="TimerOrders_Tick" />
    <div style="font-family: Book Antiqua; font-size: large; font-weight: bolder; font-style: oblique;
        position: relative; visibility: visible; overflow: scroll">
        Testing Ajax stuff !! Bob the developer.
    </div>
    <br />
    <asp:UpdatePanel ID="Updatepanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true">
        <ContentTemplate>
            <table border="1" cellpadding="0" cellspacing="0" width="100%">
                <tr align="center">
                    <td style="height: 121px; font-family: 'Times New Roman';">
                        <table border="0" cellspacing="0" width="100%">
                            <asp:Label ID="TestServerSideControl" runat="server">TestServerSideControl</asp:Label>
                            <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1" Visible="true">
                                <HeaderTemplate>
                                    <tr>
                                        <td colspan="6">
                                            Ticket Number&nbsp;&nbsp;Currency&nbsp;&nbsp
                                        </td>
                                    </tr>
                                </HeaderTemplate>
                                <ItemTemplate>
                                    <tr align="center" id="trTagOrder" style="font: Arial; font-weight: bold; font-variant: normal;
                                        color: Black;" runat="server">
                                        <td style="text-align: left; width: 80px;">
                                            <asp:Label ID="lblCur1" Text='<%#Eval("QueueID") %>' runat="server" />
                                        </td>
                                        <td style="text-align: left; width: 80px;">
                                            <asp:Label ID="Label1" Text='<%#Eval("QueueName") %>' runat="server" />
                                        </td>
                                        <td id="tdBuySell" style="text-align: center; width: 20px; padding-left: 3px;">
                                            <asp:Label ID="lblBuySell" Text='<% #Eval("GroupID") %>' runat="server"></asp:Label>
                                        </td>
                                        <td style="text-align: left; width: 65px">
                                            <asp:Label ID="lblRateStr" Text='<% #Eval("LastEditDate") %>' runat="server" />
                                        </td>
                                        <td style="text-align: left; width: 35px; padding-left: 3px">
                                            <asp:Label ID="lblOrdType" Text='<% #Eval("CreationDate") %>' runat="server" />
                                        </td>
                                        <td style="text-align: left;">
                                            <asp:DropDownList runat="server" ID="drpList1">
                                                <asp:ListItem Selected="True" Text="Test Item1" Value="1"></asp:ListItem>
                                                <asp:ListItem Text="Test Item2" Value="2"></asp:ListItem>
                                                <asp:ListItem Text="Test Item3" Value="3"></asp:ListItem>
                                            </asp:DropDownList>
                                        </td>
                                    </tr>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <tr>
                                        <td colspan="6">
                                            <br />
                                            <br />
                                            All Done!
                                        </td>
                                    </tr>
                                </FooterTemplate>
                            </asp:Repeater>
                        </table>
                    </td>
                </tr>
            </table>
        </ContentTemplate>
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="TimerOrders" />
        </Triggers>
    </asp:UpdatePanel>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:AspNetForumReportToolConnectionString %>"
        SelectCommand="SELECT [QueueID], [QueueName], [GroupID], [LastEditDate], [CreationDate] FROM [AFQueues]">
    </asp:SqlDataSource>
    </form>
</body>
</html>

Best Regards and Happy New Year!


Sincerely,
Jin-Yu Yin
Microsoft Online Community Support
"robertmazzo" <
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel1/3/2008 8:12:30 PM

1

Thank you. I see that the timer tick code works fine and displays the date and time on the asynch postback.

It stills appears to be updating all the controls whether there is a change or not. I mean, if am simply viewing the dropdownlist items, am I really changing the dropdown value ??? Even the hyperlinks get locked up and there's no change at all.

I think there's an inherent problem with UpdatePanels while used in conjuction with certain asp controls. It appears that it is a bug of some sort. Perhaps a JSON solution or some other Ajax solution is my best bet. I simply cannot present something like this to my client.

Bob

"Jin-Yu Yin - M
NewsGroup User
Re: Issue with Repeater control inside an UpdatePanel1/4/2008 3:41:49 AM

0

Hi,

I still cann't understand you well.

I have said:

If you do some change with the controls which are in the updatepanle that is updating. The change will be changed back when the Ayncpostback is returned.because when the Ayncpostback is returned back,AJAX replace the whole content of the updatepanel with the content from the server.

And I can tell you that, all AJAX solutions work that way. If you do some changes between the the Ayncpostback beginnng and returnning,the changes will be replaced by the result returned by the server.

If you really cann't present it like this, I think you should do same javescript work.

I sugest you save the changes to some hidden feilds outside the updatepanel, when the changes is replaced by the result returned by the server,you can change them back using the hidden feilds.

 Best Regards,


Sincerely,
Jin-Yu Yin
Microsoft Online Community Support
10 Items, 1 Pages |< << Go >> >|



Free Download:






   
  Privacy | Contact Us
All Times Are GMT