473,387 Members | 1,863 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Inheriting from RepeaterItem

Hi All,
I'm having a metal blank. This is my class:

public class MyRepeaterItem : System.Web.UI.WebControls.RepeaterItem
{
public MyRepeaterItem(int itemIndex, ListItemType itemType) :
base(itemIndex, itemType) {}
public bool IsDataItem {
get {
return ((this.ItemType == ListItemType.Item) || (this.ItemType
== ListItemType.AlternatingItem));
}
}

public Image Images(string ID) {
return (Image)FindControl(ID);
}
}

and this is my code:

protected void repFiles_ItemDataBound(object sender,
RepeaterItemEventArgs e) {
MyRepeaterItem rep = (MyRepeaterItem)e.Item;

if (rep.IsDataItem) {
rep.Images("icon").ImageUrl = "icons/testing.jpg";
}
}

and I get the error "Unable to cast object of type
'System.Web.UI.WebControls.RepeaterItem' to type 'MyRepeaterItem'."

All I want to do is add some helper functions to the RepeaterItem. Any
helpp would be great.
Thanks,
Oct 29 '08 #1
0 1133

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

Similar topics

1
by: richardlane | last post by:
Hi, basic question here - I'm struggling with the transfer from asp to asp.net a bit, especially in seeing the 'bigger picture' of how things are best structured. I have a website made up...
11
by: Noah Coad [MVP .NET/C#] | last post by:
How do you make a member of a class mandatory to override with a _new_ definition? For example, when inheriting from System.Collections.CollectionBase, you are required to implement certain...
3
by: DonRex | last post by:
Hello all! I couldn't find a web application-newsgroup for ASP.NET, so I'm sorry if this is the wrong forum! Synopsis: In my webform I have 3 nested repeaters: rpWeeks ----- rpTime
2
by: ric carrasquilla | last post by:
first, thx to martin for helping me with my initial post. im a newbie and appreciate the help. if someone can help me with another question, please do. i have a repeater pulling job...
3
by: louise raisbeck | last post by:
Hi there, I have a brain block on finding a repeater item which matches a field from the row of the datasource. If my datasource has a column called 'somethingid' i want to find the repeateritem...
1
by: Peter Rilling | last post by:
In the Repeater.ItemCreated handler, I am hooking the RepeaterItem.PreRender method. This event fires when the RepeaterItem is being rendered, the problem is that I want access to the DataItem...
2
by: Charles Law | last post by:
I want a set of controls that all have a border, like a group box. I thought I would create a base control containing just a group box from which my set of controls could inherit. Assuming that...
3
by: Alex Satrapa | last post by:
There's some mention in the (old!) documentation that constraints such as foreign keys won't include data from inheriting tables, eg: CREATE TABLE foo ( id SERIAL PRIMARY KEY ); CREATE TABLE...
3
by: champ.supernova | last post by:
I have a repeater containing dropdownlists. This subroutine is called when the selected index on one of these dropdownlists is changed... Public Sub cmbProductType_SelectedIndexChanged(ByVal...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...

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.