.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Repeater add
before every 1st item, adding
after every 2nd item

Posted By:      Posted Date: October 06, 2010    Points: 0   Category :ASP.Net

I have a repeater control:

<asp:Repeater ID="rep" DataSourceID="XMLDSCompare" runat="server">
                    <h4><%# XPath("title")%></h4>

Now if its the first item in the total resultset, I want to add <div> to ItemTemplate control, if its the 2nd item, I want to add </div>

So output would be (not including table tags generated by repeater control):

title 1
title 2
title 3
title 4
title 5
title 6

How would I do this in the ItemDataBound event of repeater control?

View Complete Post

More Related Resource Links

Adding a list item that populates a particular part of a page

I am trying to create a list view in sharepoint designer that when you enter a list value it populates the right part of the page. Background - I am creating a list for a marketing newsletter that when you fill out the list form it will populate the marketing newsletter on page. its to save recreating it every month. the list has drop downs for addition and department and the data is inserted on the page. thanksSharepoint Customiser

Dynamically (on client side) populating data control (repeater) when dropdown item is selected

Hello!I'm currently working on a project and I want to make as much things as possible performing on client side - with as little loading as possible.The project consist of three "main" pages. On one page I use jQuery DataTable plugin which is working great. One page has tabs (using jQuery). I want to put datacontrol (repeater) on this site and when  user selects one item in dropdown, data in repeater loads on client side, without performing the action on server.I wonder if this is possible and if somebody can give me some case to help with?Thanks!I hope I was clear enough. all the best

I need to be able to disable a button inside a repeater control when an item in the data is <1

For example, I have an inventory table. If any one of the items is less then one, I need to disable the button. <asp:Repeater id="repeater1" <ItemTemplate> <asp:Button id=btnSize /> </ItemTemplate> </asp:Repeater>  

Adding SplashScreen Item

Hi all, I need to add the SplashScreen Item to my c# project. I see that this item is already appear in the VB.Net project, but I don't have it in the C# project.   How can add it ? What is the problem it does't appear in the c# project?   Thanks in advance...

Item repeater with AccordionPane

Hello  to all!This is my first post here, so please welcome me!I'm a novice in ASP.NET and AJAX Toolkit but i made some tryes and looks like very nice!I was trying to build an accordion pane fetching data from database and decided to use item repearter.So i wrote this code <asp:SqlDataSource ID="sqlsedi" runat="server" ConnectionString="$ ConnectionStrings:ConnToRead"> </asp:SqlDataSource> <asp:Repeater runat="server" DataSourceID="sqlsedi" ID="repeatersedi"> <HeaderTemplate> <asp:Accordion runat="server" ID="panesedi"> <Panes> </HeaderTemplate> <ItemTemplate> <asp:AccordionPane runat="server"> <Header> Codice sede: <%# Container.DataItem("ddcodice")%></Header> <Content> <label class="label"> Nome sede: <%# Container.DataItem("ddnomdes") %></label> </Content> </asp:AccordionPane> </ItemTemplate> <FooterTemplate> </Panes> </asp:Accordion></FooterTemplate

jQuery instead of UpdatePanel (repeater loads when item in dropdown is selected)

Hello!I want to develop web page on which most of the things happens on clientside. The page contains several tabs (jQuery). One tabbed section have repeater which load when item in dropdown is selected.I've placed this 2 controls in UpdatePanel. Does somebody have any example how to achieve this without UpdatePanel, with jQuery?  I've heard that UpdatePanels are bad for page performance. I'm very new to jQ and Ajax.Thanks!all the bestBlaz

VS2010 has stopped working error adding new item to folders in MVC2



   I am using VS2010 Pro in 64 bit Windows 7. When I add a new item to a folder in an ASP.NET MVC2 project, VS frequently crashes with a "Visual Studio has stopped working" error and then closes down. If I re-open the project the item is not visible in the MVC project folder, (but it is visible to windows explorer although I think it's corrupted). If I then try to add the item again, it warns me that it already exists and asks to overwrite, choosing yes to overwrite usually works OK.  When adding an .edmx item it is more problematic, I can't overwrite it but because I know that there actually is a file in the folder, (although not visible and albeit corrupted), I can add it as an existing item and then choose "update model from database" to get it to work. This error is happening more and more frequently.

event handler - item adding and updating..example



I am a beginner to event handlers..I need to create something like..items created in List A should appear in List B, and when it is updated, it should appear in List B as well..are there like free samples that I can work on..I am not really good at programming

When adding new calendar item the title field is missing - MOSS 2007



A staff member just noticed that when adding a new item to a vacation calendar we have set-up - the Title column is missing.  They will finish creating the new calendar item and then when they go to edit it the Title column appears and they can fill it in.

Can figure out what caused this or how to fix - any ideas?

When I create a new test calendar the title column is displayed properly when creating new item - so not sure what happened with this calendar.

Hope someone has come across this before.

Thanks so much!

Issue with Announcement content type and adding a new item



I have the following issue with the (Silverlight?) form to add a new item:If the screen has many fields so scroll bars appear (i.e. it's longer than the screen), you can move up and down. YET, if you press to attach a file, the scroll bars dissapear, so you can't see the rest of the form.

To reproduce: 

a) make an annoucement list

b) Add a choice field, add many choises and enable multiple values - in order to have a longer-than-the-screen input form.

c) Go to the list , press add-new-item and attach a file: After that, you won;t be able to see all the input form.



Changing data item value Repeater dynamically


How do i dynamically change the value of dataitem in repeater control(.net 2.0,VS 2005)..i have repeater something like this :
<asp:Repeater ID="rptGameInfo" runat=server OnItemDataBound="itemDataBound_rptGameInfo"  >
<HeaderTemplate >

<ItemTemplate >
<asp:Label ID="lblLoc" runat=server Text="Location:" ></asp:Label><%# Eval("GAME_LOCATION")%><br />
</ItemTemplate >

and it shows the result like this:

If location is "Select" i want to change it to "n/a". So i am trying to capture it in itemDataBound even something like this

if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
                DataRowView row = e.Item.DataItem as DataRowView;
                string location = row["GAME_LOCATION"].ToString();

                if (location == "Select"

Event receiver while item adding in a document library in SharePoint2010



In my SP site i have various document sets.while i adding a new doc in the document set,i have to find the document belongs to which document set.I want to do it an event receiver..Please help me.

Event receiver while item adding in a document library in SharePoint2010



In my SP site i have various document sets.while i adding a new doc in the document set,i have to find the document belongs to which document set.I want to do it an event receiver..Please help me.

Specify page to redirect to when adding a item


Hey guys/girls/aliens

When I add a new item to a list and I click on the OK button (NewForm.aspx), I want it to redirect to a other page
How can I do this?

Reason for this is because I modified the NewForm.aspx and added some javascript to it.
This causes the link to go to the Homepage instead of going back to the listview.




By the way, If i can solve this by adding the JS to the masterpage instead of the NewForm.aspx page.
Please tell me how :P

Validation when adding a new item and no target to source binding has yet taken place


Using: WPF (.NET 4) with Entity Framework on a SQLCE database.

In my app, the user can edit existing employees and create new employees. The same UI control is used to add and edit. In the case of editing an Employee, the DataContext for the control is the Employee object of my Entity Framework context. It is updated through binding, and the SaveChanges method is called on my EF to update the database. In the case of adding and Employee, the DataContext is a new Employee object, which will gets added to the EF and then saved. Simple.

I've been trying to hook-up validation to the control. I'm using WPF's ValidationRule objects for each field binding as required. When the field loses focus (as is the default action for a target to source binding), the validation rules are checked, which can incur an error. I can then check for the presence of these errors before allowing the employee to be saved.

But when adding a new Employee, if I go ahead and push the Save button without doing anything else, no validation takes place, becasue the bindings have never attempted to update the source! It just throws an exception as expected.

What can I do? I have ideas which would probably work, but I thought I should post here first in case I am missing something obvious! Is there a standard way to deal with t

adding ribbon item to new panel

how do i add ribbon item to a new panel at the right hand side of Actions on dispform.aspx using Sharepoint Designer2010? i dont want it under Manage or Actions but want a new panel. how do i create one?

Adding new items to a Repeater control with transitions?



I am currently in the process of writing a facebook type 'activity feed' for a site. Currently I am binding the last 10 items to a repeater control, which contains a usercontrol representing each item. This works fine but there are a couple of requiremnts that are giving me problems and wondered if the the good people of the forum could make some suggestions.

The requirement is that when a user clicks a refresh button any new events are added to the top of the list, the previous items drop down and the equivalent number of old items drop off the bottom, all with nice slider transitions.

I have put the repeater inside of an update control and are able to handle the transitions by using RegisterStartup script to drop jquery calls onto the page for the slider. However I cannot find a way to dynamically add or remove new datarows to the repeater. I need the old items to stay in the repeater and be pushed down by the new items, so completely refreshing the datasource seems like a bad idea.

I was thinking about maybe storing the datasource in the viewstate and adding rows to that, maybe with an extra column on the end which stores what transition is needed on the databind for my jquery, but there will be a 'View more items' link at the bottom of the page, so I am worried that the list could get pretty large and there

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend