repeater

How to get literal content value in Repeater

天涯浪子 提交于 2019-12-06 11:10:38
I have a repeater as shown below. How to get the Report ID in code behind (from the expression inside hiddenContent2) ? The expression is <%# Eval("ReportID") %> Note: I prefer a method that does not use "FindControl". ASP.NET <asp:Repeater ID="rptReports" runat="server"> <HeaderTemplate> <div></div> </HeaderTemplate> <ItemTemplate> <div id="repeaterIdentifier" class="repeaterIdentifier"> <div id="reportTitle" class="reportTitle"> <%# Eval("Title") +":" %> </div> <div id ="reportFrequency" class="reportFrequency"> <%# " Frequency - "+ Eval("Frequeny") %> </div> </div> <div class="reportContent

ASP.NET: Bind a value to a custom user control inside a repeater

不打扰是莪最后的温柔 提交于 2019-12-06 08:38:33
问题 I have an ASP.NET control that binds data to a repeater. Inside that repeater, I have another custom user control. I want to pass a value to this second control based on the current binding item. <asp:Repeater runat="server" ID="ProductList"> <ItemTemplate> <p>Product ID: <%# Eval("ProductID") %></p> <myControl:MyCoolUserControl runat="server" ProductID='<%# Eval("ProductID") %>' /> </ItemTemplate> </asp:Repeater> The repeater item template correctly prints out my Product ID with the Eval

DataItem on Repeater.Items is always null

白昼怎懂夜的黑 提交于 2019-12-06 06:43:21
问题 I am setting the DataSource of my repeater to a List (MyProducts is a simple class, consisting of only get/setters). After this and DataBind(), I can see in debugging mode that DataItem of each Repeater.Items is null. When making a postback and trying to update MyProducts, the Repeater.Items[n].DataItem is still null and Im not able to cast it, to do my work. Why isn't DataItem set on each RepeaterItem, when I databind my repeater? I cant figure/Google it out. Every other aspect of my code

Updating an image's ImageUrl within a Repeater

限于喜欢 提交于 2019-12-06 06:23:59
问题 I hope someone can help me. It's a pretty newbie question, I'm afraid. I have an image inside a repeater, and I would like to change its IMAGEURL based on parameter that's being passed to it. <asp:Repeater ID="Repeater" runat="server"> <HeaderTemplate> <asp:Image ID="imgType" runat="server" /> </HeaderTemplate> <ItemTemplate> <%# Eval("DisplayName")%> </ItemTemplate> <SeparatorTemplate> <hr /> </SeparatorTemplate> </asp:Repeater> There is a SWITCH statement in the code behind that is altering

How can i do an if statement inside a repeater

淺唱寂寞╮ 提交于 2019-12-06 01:59:45
问题 <asp:Repeater> is driving me mad.. I need to do <ItemTemplate> <% if (Container.DataItem("property") == "test") {%> I show this HTML <% } else { %> I show this other HTML <% } %> </ItemTemplate> But I can't for the life of me find any way to make that happen. Ternary isnt any good, because the amount of HTML is quite large, setting labels via a DataBind event is not very good either, as I'd have to have large blocks of HTML in the code-behind. Surely there's a way to do this.... 回答1: You

Dynamic dropdownlist in repeater, ASP.NET

匆匆过客 提交于 2019-12-05 21:48:46
Basically, the codes I have is from here : http://ranafaisal.wordpress.com/2009/02/17/dynamically-adding-removing-textboxes-in-aspnet-repeater/ However, the thing is that, I will need a dropdownlist with textboxes. The purpose of having dropdownlist is to allow users to select their country of origin. They have the option to Add or Remove the particulars they have entered before. This is my error message: 'ddlName' has a SelectedValue which is invalid because it does not exist in the list of items. Parameter name: value This is my dropdownlist code inside a repeater in Default.aspx <asp

How can I set a table row color in my repeater based on the values databound to that row in ASP.NET?

孤街醉人 提交于 2019-12-05 21:47:41
I have a repeater control: <table style="width: 100%"> <asp:Repeater runat="server" ID="rptOptions" OnItemDataBound="rptOptions_ItemDataBound"> <HeaderTemplate> <tr> <td class="GridHeader">Account</td> <td class="GridHeader">Margin</td> <td class="GridHeader">Symbol</td> <td class="GridHeader">Price</td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td class="GridRow"><asp:Label runat="server" ID="lblOptionAccount"></asp:Label></td> <td class="GridRow"><asp:Label runat="server" ID="lblOptionMargin"></asp:Label></td> <td class="GridRow"><asp:Label runat="server" ID="lblOptionSymbol"></asp:Label>

Is there any possibility to reach the index of an outer QML Repeater from the inner one (they are nested)?

给你一囗甜甜゛ 提交于 2019-12-05 15:29:05
I am trying to dynamically build a matrix of the same type of items in my QML application and keep it dynamic, so that you can change the number of rows and columns in a c++ file anytime. This has been working well, but now, to access them individually, I want to give them dynamic names. Therefore I nested two repeaters and tried to set the objectName as in the following: Repeater{ id: rows model: Matrix1.row //number of rows in Matrix1-Object Repeater{ id: columns model: Matrix1.column //number of columns in Matrix1-Object RepeatedItem{ objectName: (index) +"."+ (rows.index) //matrix elements

SQL Counter and returner, doubles the result

混江龙づ霸主 提交于 2019-12-05 15:09:40
I'm trying to make a list, showing all of my Categories on my Forum. Showing the Category name, with an ID, aswell as a count, counting how many Threads is attached to this Category. It works perfectly, however, it prints the results twice. This is the SQL SELECT categories.category_name, threads.thread_category_id, COUNT(*) AS 'threadCount' FROM threads INNER JOIN categories ON categories.category_id = threads.thread_category_id GROUP BY categories.category_name, threads.thread_category_id Here is the result And as you can see, it prints the same thing twice, which it should't. EDIT: Here is

Repeater's SeparatorTemplate with Eval

隐身守侯 提交于 2019-12-05 13:14:39
is it possible to use Eval or similar syntax in the SeparatorTemplate of a Repeater? Id' like to display some info of the last item in the separator template like this: <table> <asp:Repeater> <ItemTemplate> <tr> <td><%# Eval("DepartureDateTime") %></td> <td><%# Eval("ArrivalDateTime") %></td> </tr> </ItemTemplate> <SeparatorTemplate> <tr> <td colspan="2">Change planes in <%# Eval("ArrivalAirport") %></td> </tr> </SeparatorTemplate> <asp:Repeater> <table> Hopping that it'll generate something like this: <table> <asp:Repeater> <tr> <td>2009/01/24 10:32:00</td> <td>2009/01/25 13:22:00</td> </tr>