Note that there are some explanatory texts on larger screens.

plurals
  1. POCode-behind hangs when data binding Repeater control
    primarykey
    data
    text
    <p>I'm working on a web form in ASP.NET 4, and I need to display a long list of entries in a table based on a selection made in a drop down list. I have the following ASPX and code-behind:</p> <pre><code>&lt;form method="post" runat="server" &gt; &lt;asp:ScriptManager runat="server" ID="mScriptManager"&gt;&lt;/asp:ScriptManager&gt; &lt;asp:UpdatePanel ID="pnlLocalizationInfo" runat="server" &gt; &lt;ContentTemplate&gt; &lt;div id="selectLanguage"&gt; &lt;p&gt;Pick language &lt;asp:DropDownList ID="ddllanguage" runat="server" OnTextChanged="SelectLanguage" AutoPostBack="true" /&gt; &lt;/p&gt; &lt;/div&gt; &lt;div id="languageTable"&gt; &lt;asp:Repeater id="repTable" runat="server" OnItemDataBound="AddTableData" &gt; &lt;HeaderTemplate&gt; Language: &lt;asp:Label ID="lbllanguageTable" runat="server" /&gt; &lt;table&gt; &lt;tr&gt; &lt;th&gt;Name&lt;/th&gt; &lt;th&gt;Value&lt;/th&gt; &lt;/tr&gt; &lt;/HeaderTemplate&gt; &lt;ItemTemplate&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:Label ID="lbltableNameLocalization" runat="server" /&gt; &lt;asp:HiddenField ID="hfnameLocalization" runat="server" Value='&lt;%#((Localization)Container.DataItem).Id %&gt;' /&gt; &lt;/td&gt; &lt;td&gt; &lt;asp:TextBox ID="txttableValueLocalization" runat="server" /&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/ItemTemplate&gt; &lt;FooterTemplate&gt; &lt;/table&gt; &lt;/FooterTemplate&gt; &lt;/asp:Repeater&gt; &lt;asp:Button ID="btnupdateLocalization" runat="server" OnClick="UpdateLocalization" Text="Save" /&gt; &lt;/div&gt; &lt;/ContentTemplate&gt; &lt;/asp:UpdatePanel&gt; &lt;/form&gt; </code></pre> <hr> <pre><code>public void SelectLanguage(object sender, EventArgs e) { string lang = ddllanguage.SelectedValue; if (ddllanguage.SelectedIndex != 0) { repTable.DataSource = Data.GetAllLocalizations(lang); repTable.DataBind(); } } </code></pre> <p>The call <code>GetAllLocalizations</code> returns an ArrayList with database entities that are later used to populate the Repeater table. However, the <code>DataBind</code> function hangs upon calling, so the entire form stops working whenever the drop down list is changed. If the data binding is done on page load and not in an event handler, it works fine. I have another, older page that uses this same method though (data bind in event handler of a drop down list) and it works without a hitch.</p> <p>Any ideas?</p>
    singulars
    1. This table or related slice is empty.
    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