473,809 Members | 2,728 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Repeater DataItems is null

Hello.
Trying to bind data from a Repeater and ITemplate, but everytime I bind the
senders dataitem is null.

I've an:
public void InstantiateIn(C ontrol container)
{
Table t = new Table();
TableRow tr = new TableRow();
TableCell tc = new TableCell();
TextBox l = new TextBox();
l.DataBinding += new EventHandler(tc _DataBinding);
tc.Controls.Add (l);
tr.Cells.Add(tc );
t.Rows.Add(tr);

container.Contr ols.Add(t);
}
void tc_DataBinding( object sender, EventArgs e)
{
TextBox tc = (TextBox)sender ;
RepeaterItem container = (RepeaterItem)t c.NamingContain er;
tc.Text = ((DataRowView) container.DataI tem)["CustomerID "].ToString();

}

But the RepeaterItem is empty :-(

Can somebody try to explain me why? Im a bit confused?:?:?

Kind regards

Jul 5 '06 #1
1 2831
Never mind :-)

I found out all by myself... Apparantly the DataItem only works the
ItemTemplate and not the HeaderTemplate.

Have a nice day....

"Bobstar" wrote:
Hello.
Trying to bind data from a Repeater and ITemplate, but everytime I bind the
senders dataitem is null.

I've an:
public void InstantiateIn(C ontrol container)
{
Table t = new Table();
TableRow tr = new TableRow();
TableCell tc = new TableCell();
TextBox l = new TextBox();
l.DataBinding += new EventHandler(tc _DataBinding);
tc.Controls.Add (l);
tr.Cells.Add(tc );
t.Rows.Add(tr);

container.Contr ols.Add(t);
}
void tc_DataBinding( object sender, EventArgs e)
{
TextBox tc = (TextBox)sender ;
RepeaterItem container = (RepeaterItem)t c.NamingContain er;
tc.Text = ((DataRowView) container.DataI tem)["CustomerID "].ToString();

}

But the RepeaterItem is empty :-(

Can somebody try to explain me why? Im a bit confused?:?:?

Kind regards
Jul 5 '06 #2

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

Similar topics

0
1466
by: Gastin | last post by:
I am digesting a web serivce from Amazon.Com. I have the following class which was autogenerated by VS.NET when I created a Web Reference to http://webservices.amazon.com/AWSECommerceService/AWSECommerceService.wsdl AmazonWebService.com.amazon.webservices.Item As you can see from the code snippets below it has public member variables rather than public Properties. When I use <%# DataBinder.Eval(Container.DataItem, "ASIN") %> syntax in...
9
10157
by: Ric | last post by:
im new to asp.net. please help if u can. is it possible to refer to a control(ie lable, placeholder, textbox) that is inside a repeater object from a code behind file? when i place the control object outside of the repeater, i can refer to it from the code behind file. when i place the control object inside the repeater, i get a 'need to instanciate the control object' error. if i declare the control object inside the control behind file,...
6
397
by: Christoph Boget | last post by:
Could someone point me to a resource that discusses how to set up other controls (input box, checkbox, drop down list), etc to be used in a Repeater? I'm not having a problem displaying text in the ItemTemplate, but displaying controls has been another story altogether. thnx, Christoph
5
4305
by: qwerty | last post by:
I have tried to call the Repeater´s item´s DataItem example from Page´s functions. I have put to the Repeater ID and Name got from the database. I have tried following: CType(Repeater(index).DataItem, DataRowView)("ID") DataBinder.Eval(Repeater(index).DataItem, "ID") First get me "NullReferenceException" and second zero length string.
2
2134
by: Colin Nicholls | last post by:
Platform: ASP.NET 1.1 I have a repeater nested inside another repeater. My outer repeater is looping fine. I am manually binding the inner repeater to a DataReader obtained from another function. My objects aren't null, my ItemDataBound() method is being called, and as you can see I have verified that I have data. Yet, the repeater does not appear in the final HTML, and what's more, after
8
16620
by: Alan Silver | last post by:
Hello, I have a repeater that has code like this... <ItemTemplate> <asp:CheckBox ID="chkDelete" Text="" RunAt="server"/> .... other stuff goes here </ItemTemplate> There is a button below the repeater. When clicked, it is supposed to
9
4696
by: Jaybuffet | last post by:
my aspx has something like this <asp:Repeater id="Repeater1" runat="server"> <ItemTemplate> <mycontrol:ctl id="ctlId" obj='<%# Container.DataItem %>' showItem="true"/> </ItemTemplate> /asp:Repeater> The DataSource for this Repeater is a CollectionBase of objects and is
4
4926
by: Brad Baker | last post by:
I'm going a little crazy :) I'm trying to bind a repeater control to a dataset on page load using the following code: if (Request.QueryString != null) { string customerid = Request.QueryString; //open connection SqlConnection m_conn = new SqlConnection("Server=server; Database=database; UId=username; Pwd=password");
0
2295
by: maffarazo | last post by:
Hi! Im currenty using a repeater to loop out all my data in my database and everything is working just great =) I just have a small problem. how do I get wich id the item is from the database? I cant put it in to a label,literal or something like that. When I searched about it I found out that I should use something like <asp:placeholder /> but I dont know how to get it to work Here's my code so far aspx:
0
9601
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
10115
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9199
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
7660
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
6881
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
5687
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4332
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3861
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3014
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.