473,789 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ItemDataBound of repeater... Before or after render?

I am trying to work out how to change some values of data during
itemdatabound.

MSDN states that the ItemDataBound is called BEFORE the render... so any
changes do the data SHOULD work..

however ihave the following example... and it doesnt work at all... the
text CHANGE_Value does not come up at any time...
public void rptList_ItemDat aBound(Object Sender, RepeaterItemEve ntArgs e)

{

DataRowView drv = (DataRowView) e.Item.DataItem ;

if (drv == null)

return;

drv["body"] = "CHANGE_Val ue";// + row["body"].ToString();

}
Nov 18 '05 #1
2 6786
Hi Darren:

This event happens before render but AFTER data binding for the item.
If you change the row in the underlying data source it won't be found
since the value was already bound to the control. You'll want to
change a value in e.Item.Controls collection at this point to a
different result to appear on the screen.

HTH,

--
Scott
http://www.OdeToCode.com

On Tue, 31 Aug 2004 10:57:15 +1000, "Darren Clark"
<dc******@hotma il.com> wrote:
I am trying to work out how to change some values of data during
itemdataboun d.

MSDN states that the ItemDataBound is called BEFORE the render... so any
changes do the data SHOULD work..

however ihave the following example... and it doesnt work at all... the
text CHANGE_Value does not come up at any time...
public void rptList_ItemDat aBound(Object Sender, RepeaterItemEve ntArgs e)

{

DataRowView drv = (DataRowView) e.Item.DataItem ;

if (drv == null)

return;

drv["body"] = "CHANGE_Val ue";// + row["body"].ToString();

}


Nov 18 '05 #2
thanks.

"Scott Allen" <bitmask@[nospam].fred.net> wrote in message
news:dl******** *************** *********@4ax.c om...
Hi Darren:

This event happens before render but AFTER data binding for the item.
If you change the row in the underlying data source it won't be found
since the value was already bound to the control. You'll want to
change a value in e.Item.Controls collection at this point to a
different result to appear on the screen.

HTH,

--
Scott
http://www.OdeToCode.com

On Tue, 31 Aug 2004 10:57:15 +1000, "Darren Clark"
<dc******@hotma il.com> wrote:
I am trying to work out how to change some values of data during
itemdataboun d.

MSDN states that the ItemDataBound is called BEFORE the render... so any
changes do the data SHOULD work..

however ihave the following example... and it doesnt work at all... the
text CHANGE_Value does not come up at any time...
public void rptList_ItemDat aBound(Object Sender, RepeaterItemEve ntArgs e)

{

DataRowView drv = (DataRowView) e.Item.DataItem ;

if (drv == null)

return;

drv["body"] = "CHANGE_Val ue";// + row["body"].ToString();

}

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
2346
by: Ben R. | last post by:
I've got a repeater that's bound to a datareader and I'd like to conditionally modify the text that is being outputted. Previously, I've done this by assigning a name to attribute to the surrounding tablecell in which the <%# %> tags reside and I could use the findcontrol to grab a handle to the control by name and do any necessary modifications. I'm wondering if I can get around this? Is it necessary to assign a name to a surrounding cell?...
8
4280
by: Invalidlastname | last post by:
Hi, We are developing an asp.net application, and we dynamically created certain literal controls to represent some read-only text for certain editable controls. However, recently we found an issue which is related to the repeater. In the code shown below, if I call Repeater1.Controls.Count in the OnInit (the code fragment was highlighted in yellow) , the viewstate for the repeater will be lost during the postback. You can re-produce this...
1
627
by: Kevin Hector | last post by:
Hi. Can anyone explain why, when setting the Text of a Label control in the ItemCreated event of a Repeater (example below), the Text value is NOT persisted to ViewState? I know this can be fixed by using the ItemDataBound event, but I don't understand why. here's a page snippet: <asp:Repeater runat="server" id="myRepeater" OnItemCreated="myRepeater_ItemCreated"> ... <ItemTemplate><tr><td><asp:Label id="myLabel" runat="server"...
1
2397
by: Matthew Law | last post by:
Hi, I have a repeater in my vb.net page which needs to render an image control (it's a mappoint linedrive map image). The repeater itself is bound to an array of object 'Directions' which contains mostly strings, but one of the Properties of the Direction Class is an image of type System.Web.UI.WebControls.Image. Obviously, if I try to render it in the repeater with the same technique used for a string:
0
1263
by: KJ | last post by:
I noticed the following behavior: With 2 repeaters nested, such as: <asp:repeater id=rptrParentRepeater runat="server"> <ItemTemplate> <asp:Repeater id="rptrChildRepeater" runat="server" DataSource="<%# ((DataRowView)Container.DataItem).Row.GetChildRows(RELATION_NAME)%>"> <ItemTemplate>
0
930
by: roni | last post by:
hi. i create dataset that has 5 datatables in it. i set this dataset to repeater.datasource in the ItemDataBound event of the repeater i can access to the first table with : Dim dr As DataRowView dr = CType(e.Item.DataItem, DataRowView)
4
15315
by: Dennis E. Jones, Jr. | last post by:
I'm creating a dynamic control for each row in a REPEATER based on database values. ItemDataBound creates the control for the initial load (not postback), but I cannot get the control recreated when command to save data (postback) occurs. How do I get the values for this dynamic control on postback and place the control back into its original position? Sample Uses Pubs Database for SQL Server: Imports System.Data.SqlClient
1
17048
by: Timbo | last post by:
Hi all, This is my first message here so i'll try and include all the information that will help you help me out, if possible. Basically I am using C# in ASP.NET 2.0 and have a Repeater control in my aspx page with two image buttons, one for an edit command, another a delete command. Here is a cut down code fragment. ...
1
1036
by: Loading name... | last post by:
hey asp.net 2.0 I have a ItemDataBound event in my repeater control. My problem is that I don't know how to access the data in the ItemDataBound control. Lets say the datasource has a field named "helloworld" and I have a label named "lblName" in the repeater control: lbName = e.item
0
9511
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10408
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10199
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9020
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7529
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5417
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3700
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2909
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.