Note that there are some explanatory texts on larger screens.

plurals
  1. POUpdatePanel inside Repeater
    primarykey
    data
    text
    <p>In my UserControl, Im trying to update a updatepanel that is inside a repeater like this:</p> <p>HTML-Markup</p> <pre><code>&lt;asp:UpdatePanel ID="updDocumentQuickView" runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;asp:Repeater ID="repFolders" runat="server" OnItemDataBound="repFolders_OnItemDataBound" OnItemCommand="repFolders_OnItemCommand"&gt; &lt;ItemTemplate&gt; &lt;asp:LinkButton ID="lnkFolder" runat="server"&gt;&lt;/asp:LinkButton&gt; &lt;asp:UpdatePanel ID="updFiles" runat="server" UpdateMode="Conditional"&gt; &lt;ContentTemplate&gt; &lt;asp:Repeater ID="repFiles" runat="server" OnItemDataBound="repFiles_OnItemDataBound"&gt; &lt;ItemTemplate&gt; &lt;%# Container.DataItem %&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/ItemTemplate&gt; &lt;/asp:Repeater&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; </code></pre> <p>C#-code</p> <pre><code>protected void repFolders_OnItemCommand(object sender, CommandEventArgs e) { int intRow = -1; ScriptManager myScriptManager = (ScriptManager)Page.Master.FindControl("myScriptManager"); Match myMatch = Regex.Match(myScriptManager.AsyncPostBackSourceElementID, "repFolders.ctl([0-9]*).lnkFolder"); if (myMatch != null) intRow = Convert.ToInt32(myMatch.Groups[1].Value); if (intRow &gt; -1) { RepeaterItem myItem = repFolders.Items[intRow]; Repeater repFiles = (Repeater)myItem.FindControl("repFiles"); UpdatePanel updFiles = (UpdatePanel)myItem.FindControl("updFiles"); string[] arr1 = new string[] { "array item 1", "array item 2", "array item 3", "array item 4", "array item 5" }; repFiles.DataSource = arr1; repFiles.DataBind(); updFiles.Update(); } } </code></pre> <p>The end result I get is that updDocumentQuickView is the UpdatePanel that gets updated, and not updFiles. If i wrap an UpdatePanel around lnkFolder, then that UpdatePanel gets updated, with the same C# code. Ive checked what kind of data that are sent back with fiddler, and the wrong UpdatePanel is sent. Im getting the correct RepeaterItem, and both repFiles and updFiles are found. What do I miss to get the right UpdatePanel to get updated?</p> <h2>UPDATE</h2> <p>Hawxby solution solved the problem with updDocumentQuickView getting updated, thanks for that. But im still having problems with updFiles sending nothing back. Some further testing, with putting literals inside updFiles and working, tells me that theres something with repFiles that isnt returned. repFiles does have data that is bounded.</p> <h2>FINAL SOLUTION</h2> <p>repFiles.Visible were set to false in repFolders_OnItemDataBound, no wonder it didnt show.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload