![]() |
| |||||||
| Sponsored Links |
![]() | « Previous Thread | Next Thread » |
| | LinkBack | Thread Tools | Display Modes |
|
#1
| ||||
| ||||
| Hi i'm populating a Repeater like so: Code: Dim ProjectsList As New ProjectsList ProjectsList = ProjectsManager.GetList(orderby) rpProjectList.DataSource = ProjectsList rpProjectList.DataBind() and then bind it to my Repeater. I was thinking that I would nead to do a 'For each item in ProjectsList' but i couldn't get it right? am i going about this all wrong ![]() Shem |
| Sponsored Links |
|
#2
| ||||
| ||||
| Not wrong. What you need to do is bind the data to the repeater and then have OnItemDataBound in your repeater control. .aspx Code: <asp:repeater id="repeater1" runat="server" OnItemDataBound="repeater1_OnItemDataBound"> Code: Protected Sub repeater1_OnItemDataBound(ByVal s As Object, ByVal e As RepeaterItemEventArgs)
If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then
Dim textbox1 As textbox = e.item.FindControl("textbox1")
Dim Project As ProjectBOL = e.Item.DataItem
'Do whatever you want with your values
if Project.editedby = "shem" then
textbox1.Text = "Some Idiot"
else
textbox1.Text = "A Brilliant Employee"
End If
End If
End Sub
That's the basic principle though. Use OnItemDataBound Last edited by richyrich; July 9th, 2008 at 04:54 AM. |
| The Following User Says Thank You to richyrich For This Useful Post: | ||
Shem (July 9th, 2008) | ||
|
#3
| ||||
| ||||
| lol RR ![]() i love that if loop |
|
#4
| ||||
| ||||
| explain to me what's going on here? Code: If e.Item.ItemType = ItemType.Item Or e.Item.ItemType = ItemType.AlternatingItem Then Shem |
|
#5
| ||||
| ||||
| not bad for writing of the top off your head RR, I see it is .Net jargon.. changed it slightly to: Code: If e.Item.ItemType = ListItemType.Item Or e.Item.ItemType = ListItemType.AlternatingItem Then |
|
#6
| ||||
| ||||
| Quote:
![]() The reason I can never remember them is because VWD autocompletes code for you, so I never have to type it... ![]() <edit>Changed my code above</edit> Last edited by richyrich; July 9th, 2008 at 04:55 AM. |
![]() |
|
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| populate datasource control from DDL | Shem | .Net Development | 22 | June 30th, 2008 08:14 AM |
| Accessing a Public Property in a web service | richyrich | .Net Development | 0 | May 23rd, 2008 08:42 AM |
| Accessing controls in the Footer of a datalist | richyrich | .Net Development | 6 | May 12th, 2008 12:19 PM |
| Accessing skmmenu control in Master Page | richyrich | .Net Development | 13 | March 18th, 2008 11:45 AM |