This is a migrated thread and some comments may be shown as answers.

RadAjaxManager and dynamic controls in Repeater

1 Answer 221 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Evgeny Savkhalov
Top achievements
Rank 1
Evgeny Savkhalov asked on 05 Aug 2010, 09:02 PM
I am building application component with some restrictions. User control contains following:

<

 

rad:RadAjaxManager ID="RadAjaxManager1" runat="server"></rad:RadAjaxManager>

 

<

 

rad:RadAjaxPanel ID="RadAjaxPanel" runat="server" HorizontalAlign="NotSet" LoadingPanelID="AjaxLoadingPanel1" ScrollBars="None">

 

 

<div style="display:none;">

 

 

<asp:Button ID="btnRebind" runat="server" onclick="btnRebind_Click" />

 

 

</div>

 

 

<asp:Repeater ID="lstRefs" runat="server" OnItemDataBound="lstRefs_ItemDataBound" OnItemCreated="lstRefs_ItemCreated"></asp:Repeater>

 

 

<asp:PlaceHolder ID="ph" runat="server"></asp:PlaceHolder>

 

 

<uc:SubWin ID="winRefEdit" runat="server" TargetPage="RefEdit.aspx" />

 

</

 

rad:RadAjaxPanel>

 

<

 

rad:AjaxLoadingPanel ID="AjaxLoadingPanel1" runat="server" Transparency="0">

 

 

<table style="height:100%;width:100%;" border="0">

 

 

<tr style="vertical-align:middle">

 

 

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

 

 

<img src='timer.gif' alt='Timer' />

 

 

</td>

 

 

</tr>

 

 

</table>

 

</

 

rad:AjaxLoadingPanel>

When I define ItemTemplate inside component - everything works well. However, there is a special requirement to make template editable by simple tools (texteditor). That is why I am defining template as ITemplate control in code and assign it to Repeater. In aspx page user places something like:

<table>
<uc:SpecialCompoment ID="sp1" runat="server>
   <MyItemTemplate>
      <tr>
         <td>Name:<ItemData Field="Name"></td><td style="font-weight:bold">Last name:<ItemData Field="Surname"></td>
      </tr>
   </MyItemTemplate>
</uc:SpecialCompoment>
</table>

Then I am parsing the content of template at ItemDataBound event and replacing artificial tags <ItemData> with real values.

Now I need to add controls to issue command to update/delete records. I am catching ItemCreated event and parsing the template for <ItemAction Action="Edit"> and <ItemAction Action="Delete"> and replacing them by Button controls, settings unique ID, and CommandName.

Without RadAjaxManager everything works.

With RadAjaxManager it work but result it strange. When loaded it looks like that:

Name:John Last name:Doe Edit Delete
Name:Bill Last name:Smith Edit Delete
Name:Erik Last name:Peters Edit Delete

After editing (by command a subwindow opens and after completion of edit javascript call server to rebind repeater) it looks following:

Name:Joanna Last name:Doe Edit Delete
Name:Bill Last name:Smith Edit Delete
Name:Erik Last name:Peters Edit Delete

Name:John Last name:Doe Edit Delete
Name:Bill Last name:Smith Edit Delete
Name:Erik Last name:Peters Edit Delete


As you can see, it replicated the content (except HTML) of edited repeater ABOVE the original, that stays untouched.

Any idea why it is and how to fix it ?

 

1 Answer, 1 is accepted

Sort by
0
Evgeny Savkhalov
Top achievements
Rank 1
answered on 06 Aug 2010, 11:55 AM
The problem is identified and solved.
In Repeater's Item template I've been using construction of <tr><td></td><td></td><-tr>, and <table></table> tags hand been placed OUTSIDE Repeater's markup. RadAjaxManager was placing its DIV's in between of </tr><tr> tags, failing to reconstruct the table due to this violation of HTML.
Tags
Ajax
Asked by
Evgeny Savkhalov
Top achievements
Rank 1
Answers by
Evgeny Savkhalov
Top achievements
Rank 1
Share this question
or