Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / January 2008

Tip: Looking for answers? Try searching our database.

Creating Browsable DataSource and DataMember properties

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mzwilli - 31 Jan 2008 17:35 GMT
Hi, I'm trying to create browsable DataSource and DataMember
properties on a user control.

The idea is to create a descendent object, place a dataset then
specify the DataSource (DataSet) and DataMember (DataTable) by
browsing the controls properties.

I am close, but somtimes get an error when bad values get put into the
DataMember property.

Pretty sure I'm missing something.  Can anybody help?  Thanks!

Here's what I have so far:
       /// <summary>
       /// The DataSet used as the Master row set.
       /// </summary>
       [Browsable(true)]
       [Category("Data")]
       [Description("The DataSet used for this Child row set.")]
       public System.Data.DataSet DataSource
       {
           get
           {
               return _DataSource;
           }
           set
           {
               _DataSource = value;
           }
       }

       /// <summary>
       /// The Table in the DataSet used for this Child row set.
       /// </summary>
       [Browsable(true)]
       [Category("Data")]
       [Description("The Table in the DataSet used for this Child row
set.")]
       public System.Data.DataTable DataMember
       {
           get
           {
               return _DataMember;
           }
           set
           {
               _DataMember = value;
           }
       }
Nicholas Paldino [.NET/C# MVP] - 31 Jan 2008 18:27 GMT
Well, you shouldn't be typing the DataSource property as a DataSet and
the DataMember property as a DataTable, as databinding only requires that
the data source implement IList.

   You should check the DataSource and DataMember properties on other
data-bound controls through Reflector, and take note of the attributes
applied to those.  If you copy them, they will enable design-time support
for setting the data source and data member through the designer.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> Hi, I'm trying to create browsable DataSource and DataMember
> properties on a user control.
[quoted text clipped - 45 lines]
>            }
>        }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.