repeater

How can I tell which button in a repeater got pressed?

試著忘記壹切 提交于 2019-12-11 08:24:56
问题 I have the following markup in an .aspx file: <asp:Repeater ID="ListOfAssignments" runat="server" OnItemDataBound="ListOfAssignments_ItemDataBound"> <ItemTemplate> <asp:Label ID="AssignmentID" runat="server" Text="Label"></asp:Label> <br /> <asp:Label ID="PathToFile" runat="server" Text="Label"></asp:Label> <br /> <asp:Button ID="RemoveAssignment" runat="server" Text="Remove" OnClick="RemoveAssignment_Click"/> </ItemTemplate> </asp:Repeater> There are two labels and a button in a fairly

Can I use loops in repeater? Is it recommended?

淺唱寂寞╮ 提交于 2019-12-11 07:39:07
问题 My datasource has an Rating dataItem contains an integer from 0 to 5. I'd like to print stars accordignly. I'm trying to do it within Repeater control: <b>Rating:</b> <% for (int j = 1; j <= DataBinder.Eval(Container.DataItem, "Rating"); j++) { %> <img src="App_Pics/fullstar.png" /> <% } for (int j = 1; j <= 5 - DataBinder.Eval(Container.DataItem, "Rating"); j++) { %> <img src="App_Pics/emptystar.png" /> <%} %> I get the error The name 'Container' does not exist in the current context . It is

Variable number of columns with Repeater control ASP.NET 3.5

让人想犯罪 __ 提交于 2019-12-11 06:49:26
问题 One of pages contains a Repeater control. Earlier, I bind a static number of columns to the repeater. For example, my stored procedure will return Name,Age,Salary,Phone,DOB of an employee. So I could use like the following <ItemTemplate> <tr> <td> <asp:Label ID="lblSalary" runat="server" Text='<%#Eval("Salary")%>' ToolTip="Salary"></asp:Label> </td> </tr> </ItemTemplate> Now I want to change the design. I have a settings page and I will say which columns should be listed here. Some time I

How to pass multiple values with Link Button Inside repeater to another page?

邮差的信 提交于 2019-12-11 06:42:44
问题 I have a Link Button Inside Repeater Control and I want pass to another page <ItemTemplate> <tr> <td bgcolor="#D8E1EA" style="display: none"> <asp:Label ID="empId" runat="server" Text='<% # Eval("emp_id")%>' /> </td> <td> <asp:LinkButton ID="lnkRowSelection" runat="server" Text='<% # Eval("FullEmpName")%>' CausesValidation="false" CssClass="navigationlink" CommandName='<% # Eval("FullEmpName")%>' CommandArgument='<%#Eval("emp_id") %>' OnClick="ButtonLink_Click" ForeColor="black" Font

how can I create an image gallery from a list of image URLs?

牧云@^-^@ 提交于 2019-12-11 06:38:34
问题 I'm able to get a bunch of image URLs using Amazon SimpleDB. I'm trying to understand the best way to bind the URL's to a Repeater and create a photo gallery. Repeater may not be the best Data control, so I'm open to suggestions if you can think of a better way. List<string> imgURLS = new List<string>(); String selectExpression = "Select * From Gallery Where Category = 'imgurls'"; SelectRequest selectRequestAction = new SelectRequest().WithSelectExpression(selectExpression); SelectResponse

Retrieve datatable.column value in rpt_RowDataBound sub in asp.net

岁酱吖の 提交于 2019-12-11 06:22:57
问题 Based on the selected answer in this post Displaying records grouped by month and year in asp.net, I have a modification to work with. In the rpt_RowDataBound sub, instead of using a FileInfo object, I need to use a database value ("statusupdate"). If month <> TryCast(e.Item.DataItem, FileInfo).CreationTime.Month OrElse year <> TryCast(e.Item.DataItem, FileInfo).CreationTime.Year Then How can I replace the " FileInfo " in the above code line with datarow("statusupdate") Code: HTML: <asp

how to check the checkbox inside the repeater at binding time accordingto value?

烂漫一生 提交于 2019-12-11 06:17:49
问题 I have a repeater and inside it i have a checkbox. Now i want to check it according to columns value(0/1). I have tried it through the itemDataBound event of the repeater. what its doing if the rows has value 1 then its checked all checkbox and if first checkbox is unchecked then its unchecked all. my code is:- ` <td align="center"> <asp:CheckBox ID="chk" runat="server" /> </td> </tr> </ItemTemplate> </asp:Repeater>` The ItemDataBound events code is :- protected void rp_ItemDataBound(object

DropDownList OnSelectedIndexChanged event stops working when seemingly unrelated User Control is added

99封情书 提交于 2019-12-11 05:56:16
问题 I have a page with a repeater. Inside each item of that repeater are update panels, each containing a control: <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:Label ID="Label1" runat="server" Text='<%# Eval("Property1") %>' /> </ContentTemplate> </asp:UpdatePanel> <asp:UpdatePanel ID="UpdatePanel3" runat="server" UpdateMode="Conditional"> <ContentTemplate> <asp:DropDownList ID=

repeater row highlight does not persist after postback

≯℡__Kan透↙ 提交于 2019-12-11 04:02:07
问题 I'm working on highlighting a repeater row when i click anywhere on that row. And then when i click on another row, the previous row becomes unhighlighted. So it's working, but only for a split second. Once the modalpopup appears, the highlight is gone. By the way, i have a linkbutton in every row that makes the modalpopup show, and i made all the labels inside the repeater as associatedcontrols. So the texts inside the repeater all kind of serve as linkbuttons. I know that the highlight

C#/ASP.NET - Cannot have repeater inside HTMLselect

我是研究僧i 提交于 2019-12-11 03:07:44
问题 I'm trying to display some data within a select using the following code: <select name="area" runat="server"> <asp:Repeater ID="RepeaterArea" runat="server"> <ItemTemplate> <option value="<%# Eval('Id') %>" runat="server"><%# Eval("Area") %></option> </ItemTemplate> </asp:Repeater> </select> I get an error stating that I cannot have a repeater inside a HTMLSelect. Any suggestions would be very welcome, thanks! 回答1: Remove the runat="server" . You can get the value by Request.Form["area"]