repeater

asp.NET: How to access repeater generated elements?

隐身守侯 提交于 2019-12-25 03:58:12
问题 i have a repeater than creates a table: <itemtemplate> <tr id="theTableRow" runat="server"> <td> <asp:LinkButton runat="server" OnClientClick="todo" Text="Do Something" /> </td> </tr> </itemtemplate> Note: the OnClientClick="todo" line. In the final rendered code, i want the todo to contain a call to a javascript function, passing: the ID of the generated table row, and the Eval of a property of the currently bound object And now for some pseudo-code : Pseudocode 1: OnClientClick="DoSomething

Repeater with multiple Itemtemplate

白昼怎懂夜的黑 提交于 2019-12-25 02:26:18
问题 How can I make a Repeater with multiple Itemtemplates ? And a template is choosed based on some condition ? 回答1: You could have a nested repeater in your repeater: http://www.worldofasp.net/tut/NestedRepeater/Repeater_within_Repeater_193.aspx But this starts getting really tricky! I'd take a look at what you are trying to achieve and evaluate if this is the best option. 回答2: You could always create hidden panels with different layouts in your itemtemplate. Then you could decide which one to

News ticker using a Repeater and Jquery

江枫思渺然 提交于 2019-12-25 02:19:31
问题 I have a ticker which uses a jquery and a Repeater.But I only get the last updated record of the 10 new_Feed table.This is the Source and the Code behind. <ul id="js-news" class="js-hidden"> <li class="news-item"> <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <asp:Label ID="myLabel" runat="server" Text='<%# Eval("Text") %>' /> </ItemTemplate> </asp:Repeater> </li> </ul> SqlConnection con = new SqlConnection(Constring); con.Open(); SqlCommand cmd = new SqlCommand("select Text

asp:HyperLink build NavigateUrl within Repeater using XPATH data

旧城冷巷雨未停 提交于 2019-12-25 01:23:45
问题 I am using a repeater for some products I am listing. I'm trying to build an asp:HyperLink NavigateUrl using both hardcoded text as well as XPATH data. NavigateUrl='mypage.aspx?ID=<%#XPath("THEID")%>&name=<%#XPath("THENAME")%>' Obviously this isn't working. Does anyone know how to make this work? 回答1: This should work: <asp:HyperLink runat="server" NavigateUrl='<%# string.Format("mypage.aspx?ID={0}&name={1}", XPath("THEID"), XPath("THENAME")) %>' Text="some link" /> 来源: https://stackoverflow

Getting image from hyperlink and not from folder to populate my Repeater Control

别说谁变了你拦得住时间么 提交于 2019-12-25 00:55:18
问题 Instead of populating my Repeater with pictures from a folder in my project i want to polulate it with a link to where the image is like so.............. http://www.erate.co.za/imgGrab.aspx?Id=99 What code changes must i make to let my code look at my hyperlink for the image and not the "pics" folder? My Page Load protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { string sBasePath = System.Web.HttpContext.Current.Request.ServerVariables["APPL_PHYSICAL_PATH"]; if (

Connecting 2 dropDownLists with SqlDataSource FilterExpression inside ASP:Repeater

↘锁芯ラ 提交于 2019-12-24 22:44:59
问题 Using 2 dropDownLists in repeater row how does one use the 1st one as a filter for 2nd? The repeater layout is simple: [category_dropDown][item_dropDown][add_button] The problem is that I can't connect two dropDown controls. SqlDataSource ControlParameter cannot find ControlID to call (controls renamed by repeater). Changing ControlID value to "itemRepeater$dropDownCategory" obviously doesn't help. How do I bind these dropDowns to work in pairs? Wondering mostly if there is a markup code

Can I place a asp:datalist inside a repeater control and databind it?

懵懂的女人 提交于 2019-12-24 17:22:08
问题 Can I place a asp:datalist inside a repeater control and databind it for each time its repeated? Using VB.NET btw.. Cheers! --Jonesy 回答1: Steps: 1. Nest the DataList in the Repeater 2. Bind each repeated Datalist during the Repeater's ItemDataBound event 3. Turn off their ViewStates,if they are not required. Update: i.e. Script Side: <asp:Repeater ID="Repeater1" runat="server"> <ItemTemplate> <asp:DataList ID="DataList1" runat="server"> </asp:DataList> </ItemTemplate> </asp:Repeater> In Code:

ASP.NET create repeater programmatically

怎甘沉沦 提交于 2019-12-24 16:25:33
问题 I'm trying to create an ASP:Repeater programmatically and I have a problem when trying to bind the columns. The tutorials I've read are quite confusing and many of them don't get to the point of binding. My problem is only in the point of binding data, when I would write this in a "static" repeater: <%# DataBinder.Eval(Container.DataItem, "Name")%> I don't know what should be when working in code-behind, it's within a class so I don't have an event handler. This is my code so far: Dim DsArbol

RadioButtonList Inside Repeater OnSelectedIndexChanged Not Firing

坚强是说给别人听的谎言 提交于 2019-12-24 11:10:00
问题 I have a RadioButtonList inside a Repeater. I have AutoPostback set to "true" and the OnSelectedIndexChanged defined. When I selected a different radiobutton in my list the page does postback, but my defined OnSelectedIndexChanged event is not catching or firing. Not sure what I am missing. Here is my markup and codebehind: 回答1: Use the repeater's itemcreated event to bind your eventhandler: protected void Repeater!_ItemCreated(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType ==

If statement in repeater control

老子叫甜甜 提交于 2019-12-24 07:48:54
问题 So depending on if the repeater item has a link or not I want to use a link around an image otherwise I just want to out put link. Right now I have <asp:Repeater ID="BannerImageRepeater" runat="server"> <ItemTemplate> <a href="<%# ((BannerImage)Container.DataItem).CallToActionUrl %>"><img src="<%# ((BannerImage)Container.DataItem).ImageUrl %>?w=980&h=600" alt="<%# ((BannerImage)Container.DataItem).AltText %>"/></a> </ItemTemplate> </asp:Repeater> So wanted to add something like String