Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
K

kloepper

@kloepper
About
Posts
12
Topics
7
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Unable to get a Profile custom (object) collection to bind to GridView,etc (IList objects)?
    K kloepper

    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 :) 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: 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

    C# csharp asp-net database help question

  • Custom Object used with Profile Object
    K kloepper

    I have a custom object that inherits from CollectionBase and it does not successfully bind to GridViews or DropdownLists. My understanding is that that is because GridViews and Dropdownlists implement IEnumerable, therefore, if I want my custom object to bind to the gridview or the dropdownlist, I need to inherit from IEnumerable also, right? Whatever the answer is, I'm trying to learn what I need to do to get my custom object to bind to a gridview and a dropdownlist. I don't think this has anything to do with it, but 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; 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 But this does not: GridView1.DataSource = Profile["Teachers"]; // Populate the GridView1 from the Profile Object GridView1.DataBind();

    C# csharp asp-net database question

  • Custom Object that has 'nested' collections
    K kloepper

    Guffa: I just got a reply elsewhere that pointed out the same error that you did, ie, that I don't have a teacher or a class object and that I cannot use the list objects in their place. > A TeacherList would not hold a ClassList. > > A TeacherList has 0-n Teacher objects. > A Teacher has 1 ClassList > A ClassList has 0-n Class objects. > A Class has 1 StudentList > A StudentList has 1-n Student objects. I'm working on the solution now. Hopefully, I'll construct it correctly. Thank you, Paul -- modified at 15:49 Tuesday 7th February, 2006

    C# question com help tutorial

  • Custom Object that has 'nested' collections
    K kloepper

    The problem: I want to allow an administrator (user) to create a list of teachers, each teacher in turn has a list of classes, each class has a list of students. There's an article at http://aspalliance.com/721 that describes making classes for the Student and the StudentList, but I'm wondering how to make classes that are collections of the other classes, ie a ClassList that holds the StudentList class and a TeacherList class that holds the ClassList class. TeacherList-->ClassList-->StudentList-->Student What is the approach to use to make a custom object that could handle this nesting? The article mentioned above has a StudentList Class that inherits from IEnumerable and uses a Hastable to hold the Student objects that are made up of simple data types. I tried making classes in a similar fashion for the ClassList and StudentList collections, but I'm having casting errors, so I'm not sure that this is the correct approach or my implementation is not correct. Anyone have any ideas or suggestions as to how to nest collections like this? or another approach to accomplish the same thing? If you want to see the code I've tried, I can post it. Thanks, Paul

    C# question com help tutorial

  • Profile in ASP.NET2.0 - Getting Items from multiple arrayLists
    K kloepper

    Actually, 2 questions 1)This question concerns extracting information stored in the user profile. In the web.config file I have the following structure, where I plan to make the first element of each arrayList a CategoryName and the subsequent elements, the items in that CategoryName. In order to create a new arrayList of the category names, how can I loop through all the arrayLists to get the first element of each arrayList, ie the CategoryName? Is it even possible to do this? If not, is there another way to create Multiple Categories that each contain an array of items? 2) ArrayList alCategoryNames = new ArrayList(); // Create a new arraylist alCategoryNames.Add(Profile.MyCategories.CatItems_01.GetRange(0,1).ToString()); I'm expecting this to return the first element in the array, but I get this instead: System.Collections.ArrayList+Range Anyone know what I'm doing wrong? Thanks, Paul

    ASP.NET question csharp asp-net data-structures

  • Remove background image from a button programatically
    K kloepper

    button1.BackgroundImage=null; worked just fine...Thank You.:) Paul

    C# question

  • Remove background image from a button programatically
    K kloepper

    Is there a way to remove the background image from a button, programatically--not manually? Thanks

    C# question

  • Save text file as html
    K kloepper

    I'm using httpwebresponse and a StringBuilder to return a stream that originates as a file with the .txt suffix (My download code converts the html tags in this text file to well formed XHTML tags). The contents of the file contain html tags and the data in those tags. eg.,

    Howdy!!

    When I copy, paste and save the returned file from the textbox (txtOutput)with a .html extension, the file opens as a normal looking html file, but when I try to save the stream with an html suffix with the following code, something changes in the file and instead of opening as a normal html file, I instead get what looks like a text file with strikethrough font in numerous places...eg., Howdy !! // Save File----------------------------------- StreamWriter writer = new StreamWriter(sec_save); writer.WriteLine(txtOutput.Text.ToString()); writer.Close(); The StreamWriter gets its input from a textbox (txtOutput) that has been populated by a StringBuilder (the html tags in the original text file have actually been converted to an XHTML file, ie well-formed html tags.) I can supply the code that converts the html to xhtml if needed... Basically, I'm just trying to find a way to save the stream as an .html file and have it open as any other html file would open, without the strikethroughs. A different way to save the stream perhaps? Thanks, Paul :wtf:

    C# html question

  • iterate over datagrid
    K kloepper

    Roman Doug and Colin Thanks to all of you. This is very cool and it works great. Thanks for pointing me in the right direction. Paul :-D

    C# html css question

  • iterate over datagrid
    K kloepper

    So I simply designate the cell by iterating over the rows and then designating the column like this dataGrid[rowNum][2]? That simple? I'm using a dataset. Thanks, Paul (I've got to go now...be back later tonight.)

    C# html css question

  • iterate over datagrid
    K kloepper

    Sorry, it is a dataset. The main point is that I want to take a record then assign the value from that row, column2 to the variable that contains the url and then assign the value from that same row and column3 to the variable that will hold the pathname.filename to save as. I just haven't figured out exactly how to do it yet. (I've actually got to run now, but I'll be back later tonight) Thanks, Paul

    C# html css question

  • iterate over datagrid
    K kloepper

    I have a datagrid with this structure: Column1 Column2 Column3 Name URL FilePathtoSaveTo There are 1000 rows in the grid and I want to use the url (Column2) in an httpwebrequest and httpwebresponse to get web pages and then use the FilePathtoSaveTo (Column3) to write the web page to disk. Anyone know of a foreach loop (or some other way) that will allow me to do this (return the cell values from columns 2 and 3 in order to be used as variables for my web request and write?) Thanks, Paul (Also, the urls return text files that when saved with the .html extension, open as html files.)

    C# html css question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups