repeater

Binding a generic list to a repeater - ASP.NET

和自甴很熟 提交于 2019-11-27 04:16:27
问题 I am trying to bind a List<AreaField> to a repeater. I have converted the list into an array by using the ToArray() method and now have a array of AreaField[] Here's my class hierarchy public class AreaFields { public List<Fields> Fields { set; get; } } public class Fields { public string Name { set; get; } public string Value {set; get; } } In the aspx, I would like to bind it a repeater (something like this) DataBinder.Eval(Container.DataItem, "MyAreaFieldName1") The MyAreaFieldName1 is the

Strange Error - CS0012: The type x is defined in an assembly that is not referenced

霸气de小男生 提交于 2019-11-27 02:31:06
问题 The type 'x' is defined in an assembly that is not referenced. You must add a reference to assembly 'abc123'. I have a .NET 2.0 web application that references my assembly 'abc123'. The assembly exists in the GAC and I've verified that it is the correct(same) version. The rest of application has no issues except for one .aspx page. The page in question has a repeater that displays a user control as one of its "fields". Upon binding a list of type y to the repeater I pass the user control a

ASP.Net: why is my button's click/command events not binding/firing in a repeater?

那年仲夏 提交于 2019-11-27 02:21:16
问题 Here's the code from the ascx that has the repeater: <asp:Repeater ID="ListOfEmails" runat="server" > <HeaderTemplate><h3>A sub-header:</h3></HeaderTemplate> <ItemTemplate> [Some other stuff is here] <asp:Button ID="removeEmail" runat="server" Text="X" ToolTip="remove" /> </ItemTemplate> </asp:Repeater> And in the codebehind for the repeater's databound and events: Protected Sub ListOfEmails_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.RepeaterItemEventArgs)

Can't find control within asp.net repeater?

孤人 提交于 2019-11-27 01:32:43
问题 I have the following repeater below and I am trying to find lblA in code behind and it fails. Below the markup are the attempts I have made: <asp:Repeater ID="rptDetails" runat="server"> <HeaderTemplate> <table> </HeaderTemplate> <ItemTemplate> <tr> <td><strong>A:</strong></td> <td><asp:Label ID="lblA" runat="server"></asp:Label> </td> </tr> </ItemTemplate> </asp:Repeater> </table> First I tried, Label lblA = (Label)rptDetails.FindControl("lblA"); but lblA was null Then I tried, Label lblA =

Set ID of Items In a Repeater

早过忘川 提交于 2019-11-26 21:51:33
问题 In my aspx, I have a repeater which contains three textboxes: <asp:Repeater ID="myRepeater" runat="server"> <ItemTemplate> <asp:TextBox ID="myTextBox" runat="server" <ItemTemplate/> </asp:Repeater> In my codebehind, I have my repeater databound to an array int data = new int[3]; So my page displays three textboxes, each with the ID of myTextBox three times. Is there a way to set those IDs to be: MyTextBox1 MyTextBox2 MyTextBox3 回答1: So my page displays three textboxes, each with the ID of

How to find controls in a repeater header or footer

白昼怎懂夜的黑 提交于 2019-11-26 21:27:59
I was wondering how one would find the controls in the HeaderTemplate or FooterTemplate of an Asp.Net Repeater control. I can access them on the ItemDataBound event, but I was wondering how to get them after (for example to retrieve a value of an input in the header/footer). Note: I posted this question here after finding the answer just so that I remember it (and maybe other people might find this useful). mbillard As noted in the comments, this only works AFTER you've DataBound your repeater. To find a control in the header : lblControl = repeater1.Controls[0].Controls[0].FindControl(

Repeater in Repeater

狂风中的少年 提交于 2019-11-26 20:16:06
I have a repeater inside a repeater. Where the parent repeater is bound to a Datatble which has a column with a Datatable in it. I would like to bind the child repeater to the datatable column in the parent repeater's datarow Is this possible? i was thinking i could do this directly in the aspx file like: DataSource="<%# DataBinder.Eval(Container.DataItem, "Products")%>" but it doesn't seem to work. In the parent repeater, attach a method to the OnItemDataBound event and in the method, find the nested repeater and data bind it. Example (.aspx): <asp:Repeater ID="ParentRepeater" runat="server"

asp.net radio button grouping

不打扰是莪最后的温柔 提交于 2019-11-26 20:11:10
问题 I am currently having an issue with radio buttons and grouping. I have an asp radio button within a repeater control. I have the group name attribute set to "Customer". When the page loads, the radio buttons are not grouped. Instead of the id fields being set to the group name, it is setting the value fields of the radio buttons. I know that I have tried setting radio buttons up outside of a repeater control and have had the same issue. What is going on here? aspx <asp:Repeater ID=

How to do AsyncPostBackTrigger for the LinkButton in the Repeater

偶尔善良 提交于 2019-11-26 19:31:36
问题 In my page, I have an LinkButton inside repeater, but the UpdatePanel cannot find the LinkButton to AsyncPostBackTrigger. Here is mycode.aspx <asp:ScriptManager ID="Test1" runat="server" /> <asp:UpdatePanel ID="TestUpdate" runat="server" UpdateMode="Always"> <ContentTemplate> <table width="100%"> <tr valign="top"> <td width="50%"> <asp:Repeater ID="productList" runat="server" onitemcommand="productList_ItemCommand"> <HeaderTemplate> <ul type="disc"> </HeaderTemplate> <ItemTemplate> <li> <asp

ASP.NET Repeater bind List<string>

≡放荡痞女 提交于 2019-11-26 19:26:50
问题 I am binding a List<string> to a Repeater control. Now I want to use the Eval function to display the contents in ItemTemplate like <%# Eval("NAME") %>. But I am not sure what I should use instead of NAME. 回答1: Just use <%# Container.DataItem.ToString() %> If you are worried about null values you may want to refactor to this (.NET 6+) <asp:Repeater ID="repeater" runat="server"> <ItemTemplate> <%# Container.DataItem?.ToString() ?? string.Empty%> </ItemTemplate> </asp:Repeater> Note if you are