Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > DetailsView did not have any properties?

Reply
Thread Tools

DetailsView did not have any properties?

 
 
Gary Wardell
Guest
Posts: n/a
 
      07-18-2008
Hi,

MSDN says that I can use DataSource properety to bind to "Any object that
implements the IList interface".

How is this done? I can't seem to find any good examples for doing it all
by hand. (Most show doing it from a database with a DataTable)

I can get it to work in C#.

I've tried using a OrderedDictionary.

If throws this exception:

DetailsView with id 'DVRecord' did not have any properties or attributes
from which to generate fields. Ensure that your data source has content.

This is the code:

OrderedDictionary NVP = new OrderedDictionary();
NVP.Add("Company", "My, Inc.");
NVP.Add("Contact", "Me");
NVP.Add("City", "My City");
NVP.Add("ZipCode", "99999");
DVRecord.DataSource = NVP;
DVRecord.DataBind();


This is the form
<aspetailsView ID="DVRecord" runat="server"
CssClass="DetailsViewStyle"
DefaultMode="Edit"
AutoGenerateRows="False"
AutoGenerateEditButton="False"
AutoGenerateDeleteButton="False"
AutoGenerateInsertButton="False"
OnPreRender="DVRecord_PreRender"
OnModeChanging="DVRecord_ModeChanging"
OnItemUpdating="DVRecord_ItemUpdating">
<FieldHeaderStyle CssClass="FieldHeader" />
<RowStyle CssClass="RowStyle" />
<EditRowStyle CssClass="EditRow" />
<AlternatingRowStyle cssClass="AlternateRowStyle" />
<CommandRowStyle CssClass="CommandRowStyle" />
<Fields>
<asp:BoundField DataField="Company" HeaderText="Company Names" />
<asp:BoundField DataField="Contact" HeaderText="Contact Names" />
<asp:BoundField DataField="City" HeaderText="City Names" />
<asp:BoundField DataField="ZipCode" HeaderText="Zip Codes" />
</Fields>
</aspetailsView>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Did this stop working? Or did it ever work? (metamagic) Daniel Waite Ruby 2 05-01-2008 11:08 PM
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
DetailsView - Changing to Insert Mode (Not By Using the Insert Button In the DetailsView Control) Feege ASP .Net Web Controls 0 12-20-2005 12:28 AM
I did the run, cmd thing, and my video actually did mess up. The Maitch Computer Support 0 04-25-2005 11:37 PM
cisco t1 isdn call to DID or DID no ring tone optimus Cisco 1 12-31-2003 04:35 PM



Advertisments