repeater

Change text of a linkbutton in a repeater

末鹿安然 提交于 2019-12-07 23:08:21
问题 I have a repeater which displays comments related to a post. I want to add some functionality where when the user click on the link it goes from: report this post to post has been flagged how do I access the specific lnkButton? Obviously in ItemDataBound this is easily done, but in the click method I'm not sure how I would do it. Do I need to do something like: I tried something like this; LinkButton lb = repeater.FindControl(LINK_BUTTON_UNIQUE_ID) as LinkButton; lb.Text = "blah blah blah";

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

纵然是瞬间 提交于 2019-12-07 16:16:39
问题 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=

Get Repeater's Items

故事扮演 提交于 2019-12-07 14:08:57
问题 I am trying to get all repeater's selected checkboxes of repeater's item just before page movement (pagination), and store them in some place. foreach (RepeaterItem ri in rpt.Items) { CheckBox box = (CheckBox)ri.FindControl("chkBox"); if (box.Checked) { ... } } The problem is where do i call this function from? I've tried to call it from ObjectDataSource1_Selected (I use objectdatasource to populate repeater) and ObjectDataSource1_Selecting but rpt.Items.Count is also 0. rpt_PreRender() event

SQL Counter and returner, doubles the result

只愿长相守 提交于 2019-12-07 11:02:34
问题 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

Repeater's SeparatorTemplate with Eval

穿精又带淫゛_ 提交于 2019-12-07 10:58:19
问题 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

How to dynamically refresh a .NET databound repeater control

不问归期 提交于 2019-12-07 01:10:27
问题 I have a .NET repeater control that is data-bound to a List. As part of the Repeater's Item Collection , I have a "Remove Button" that effectively removes this current List element. This works, in code-behind I can successfully remove an item from the datasource of the Repeater . My problem is this : when I reset the updated datasource and call MyRepeater.DataBind() again, the Repeater interface does not refresh with the Item removed. I am looking for the event to essentially redraw or

Render empty repeater

你离开我真会死。 提交于 2019-12-06 22:51:28
问题 When Repeater contains no items it's not get rendered in HTML at all, even HeaderTemplate or FooterTemplate . I need to manipulate it on client-side even if it's empty. Is there any way to always render Repeater in HTML? 回答1: In the <FooterTemplate> , add a Label with some empty data text and set its visible property to false. <FooterTemplate> <table> <tr> <td> <asp:Label ID="lblEmptyData" Text="No Data To Display" runat="server" Visible="false"> </asp:Label> </td> </tr> </table> <

jQuery form repeater and select2 dont work together

可紊 提交于 2019-12-06 16:22:02
I am using Select2 and jQuery form repeater ( https://github.com/DubFriend/jquery.repeater ) I have searched on google/so for 2 days, but cant seem to get it to work. include jquery/select2.js/jquery.repeater.js var form = $('#form'); form.find('select').select2(); form.repeater({ show: function () { $(this).show(function(){ form.find('select').select2('destroy').select2(); }); }, hide: function (remove) { $(this).hide(remove); } }); The problem is the jQuery.repeater clones the div tag in which the input and select elements are when select2 is already initialized and has already changed the

Multiple popups inside repeater

谁都会走 提交于 2019-12-06 14:40:47
问题 I am creating a mobile site where I have a list of pictorials of motorcycle models. I created the list with each image as a list-item and also added a div with the data-rel="popup" inside the list-item . Everything compiles and functions correctly, but any image I click in the list only shows the first image. I.e., when the 3rd list-item in the list is clicked and the popup is opened, image #1 is displayed. This is also true for every link in the list. Do you know why it is doing this? I know

ASP.NET - Add rows to repeater at runtime

你说的曾经没有我的故事 提交于 2019-12-06 12:11:57
问题 Public Partial Class _Default Inherits System.Web.UI.Page Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Page.IsPostBack = False Then Dim ds1 As New List(Of Link) For i = 1 To x Dim h As New Link ds1.Add(h) h.Text = "ssss" h.URL = "yyyyy" Next rptMenu.DataSource = (ds1) Else rptMenu.DataSource = ViewState("ds1") End If rptMenu.DataBind() End Sub Protected Sub addFeild() Dim ds1 As List(Of Link) = rptMenu.DataSource Dim h As New Link ds1.Add(H)