Click here to Skip to main content
15,886,919 members
Home / Discussions / C#
   

C#

 
GeneralRe: Socket Exception Delay?? Pin
ckaneAV10-Feb-06 10:19
ckaneAV10-Feb-06 10:19 
GeneralRe: Socket Exception Delay?? Pin
Wayne Phipps10-Feb-06 11:22
Wayne Phipps10-Feb-06 11:22 
QuestionProblem: No value given for one or more ... Pin
NaNg1524110-Feb-06 8:50
NaNg1524110-Feb-06 8:50 
AnswerRe: Problem: No value given for one or more ... Pin
perlmunger10-Feb-06 10:57
perlmunger10-Feb-06 10:57 
QuestionClearing Combobox Pin
Syed Umar Anis10-Feb-06 8:49
professionalSyed Umar Anis10-Feb-06 8:49 
AnswerRe: Clearing Combobox Pin
perlmunger10-Feb-06 11:02
perlmunger10-Feb-06 11:02 
QuestionListView OwnerDraw and Custom Background Pin
PicklesTheClown10-Feb-06 8:28
PicklesTheClown10-Feb-06 8:28 
QuestionUnable to get a Profile custom (object) collection to bind to GridView,etc (IList objects)? Pin
kloepper10-Feb-06 8:00
kloepper10-Feb-06 8:00 
Q. Unable to get a Profile custom (object) collection to bind to GridView,etc (IList objects)?

This is my first custom object so I may be doing something rather simple, wrong, or it may be something else to do with the Profile object. Either way, I need help Smile | :)

Here's a brief description of the code----------------------------------------------------------------------------------

1) I have a custom object: "School.Teachers" (see below)

2) which is used as a Profile object data type in the web.config file:

<profile defaultProvider="AspNetSqlProfileProvider" >

<properties>

<add name="Teachers"

type="School.Teachers"

allowAnonymous="true"/>

</properties>

</profile>



3) I'm setting the value of a Profile object (ASP.NET 2.0) equal to the custom object:



School.Teachers tlTeachers = new School.Teachers();

tlTeachers.Add(new School.Teacher("Buck"));

Profile.Teachers = tlTeachers;





4) Code like this works:

Label1.Text = Profile.Teachers.Count.ToString(); // The number of items in the profile object

Label1.Text = Profile.Teachers[1].FirstName.ToString(); // The value of an item at a particular index position



5) But this does not:

GridView1.DataSource = Profile["Teachers"]; // Populate the GridView1 from the Profile Object

GridView1.DataBind();





The custom object: "School.Teachers"---------------------------------------------

[Serializable()]

public class Teachers : CollectionBase

{

public Teachers()

{}

public Teacher this[int index]

{

set

{

List[index] = value;

}

get

{

return (Teacher)List[index];

}

}

public int Add(Teacher value)

{

return List.Add(value);

}

public int IndexOf(Teacher value)

{

return List.IndexOf(value);

}

public void Insert(int index, Teacher value)

{

List.Insert(index, value);

}

public void Remove(Teacher value)

{

List.Remove(value);

}

public bool Contains(Teacher value)

{

return List.Contains(value);

}

}


-- modified at 14:35 Friday 10th February, 2006
QuestionDispalying decimal value in the textbox Pin
zaboboa10-Feb-06 7:41
zaboboa10-Feb-06 7:41 
AnswerRe: Dispalying decimal value in the textbox Pin
Dave Kreskowiak10-Feb-06 7:45
mveDave Kreskowiak10-Feb-06 7:45 
GeneralRe: Dispalying decimal value in the textbox Pin
zaboboa10-Feb-06 7:51
zaboboa10-Feb-06 7:51 
GeneralRe: Dispalying decimal value in the textbox Pin
Dave Kreskowiak10-Feb-06 9:10
mveDave Kreskowiak10-Feb-06 9:10 
GeneralRe: Dispalying decimal value in the textbox Pin
User 665810-Feb-06 9:35
User 665810-Feb-06 9:35 
GeneralRe: Dispalying decimal value in the textbox Pin
Dave Kreskowiak10-Feb-06 12:13
mveDave Kreskowiak10-Feb-06 12:13 
GeneralRe: Dispalying decimal value in the textbox Pin
User 665811-Feb-06 2:51
User 665811-Feb-06 2:51 
QuestionTopmost Form Pin
PHDENG8110-Feb-06 7:35
PHDENG8110-Feb-06 7:35 
AnswerRe: Topmost Form Pin
NaNg1524110-Feb-06 8:56
NaNg1524110-Feb-06 8:56 
GeneralRe: Topmost Form Pin
Dave Kreskowiak10-Feb-06 9:03
mveDave Kreskowiak10-Feb-06 9:03 
GeneralRe: Topmost Form Pin
NaNg1524110-Feb-06 9:19
NaNg1524110-Feb-06 9:19 
GeneralRe: Topmost Form Pin
PHDENG8110-Feb-06 9:31
PHDENG8110-Feb-06 9:31 
GeneralRe: Topmost Form Pin
NaNg1524110-Feb-06 9:56
NaNg1524110-Feb-06 9:56 
GeneralRe: Topmost Form Pin
PHDENG8113-Feb-06 1:32
PHDENG8113-Feb-06 1:32 
GeneralRe: Topmost Form Pin
Dave Kreskowiak10-Feb-06 13:49
mveDave Kreskowiak10-Feb-06 13:49 
AnswerRe: Topmost Form Pin
Dave Kreskowiak10-Feb-06 13:52
mveDave Kreskowiak10-Feb-06 13:52 
QuestionOutlook 2003 and Signatures Pin
piXy^10-Feb-06 5:42
piXy^10-Feb-06 5:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.