PC Review


Reply
Thread Tools Rate Thread

Binding a datagrid to a System.Collections member

 
 
Sathyaish
Guest
Posts: n/a
 
      6th Sep 2005
Ok, all I am doing is trying to bind a data grid to an IDictionary.
Here goes:


Sub Page_Load(sender As Object, e As EventArgs)
If Not IsPostBack() Then Call BindData()
End Sub


Public Sub BindData()
Dim Skl As New Hashtable
Skl.Add(1, "Visual C#")
skl.Add(2, "Visual Basic")
skl.Add(3, "Win32 API Programming")

dg.DataSource = skl
dg.DataBind()
End Sub

The error I get is:

System.Web.HttpException: DataGrid with id 'dg' could not automatically
generate any columns from the selected data source.

on the line:

dg.DataBind()

So, is there some special glue when you have to bind a datagrid to a
non-relational source such as IList or IDictionary or Hashtable?

 
Reply With Quote
 
 
 
 
Sathyaish
Guest
Posts: n/a
 
      6th Sep 2005
*resolved*

found the solution here:
http://www.dotnet247.com/247referenc.../18/94997.aspx

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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
DataGridViewComboBoxColumn, binding collections of objects? Simon Tamman Microsoft C# .NET 0 24th Oct 2006 02:00 AM
Binding Custom Collections to Datagrid =?Utf-8?B?U3VyZXNo?= Microsoft ASP .NET 1 22nd Sep 2006 01:04 AM
System.Collections.Generic.Queue & System.Collections.Queue Synchronized Method nhmark64@newsgroup.nospam Microsoft C# .NET 4 18th Feb 2006 12:09 PM
Binding a datagrid to a System.Collections member Sathyaish Microsoft ASP .NET 1 6th Sep 2005 05:26 AM
Binding a datagrid to a System.Collections member Sathyaish Microsoft VB .NET 1 6th Sep 2005 05:26 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:16 AM.