Applying formatting from Access database to a GridView - asp.net

Perhaps this is mere wishful thinking, but is there a simple way (in ASP.NET) to extract (at run-time) the formatting for different columns from a table in an Access 2007 database and apply that formatting to a GridView control?
Also, is there a way to get the "Caption" values for columns in a table in the database and use those as the column headers for the GridView?
I'm new at ASP.NET, so I don't know what's possible and what isn't :-)

Yes, this is wishful thinking. The drivers for ADO.NET to Access don't give you style information.

Related

ASP.Net Datagridview paging without using SQL Server

I'm working on one project where data is coming from the WCF web services and in the List format.
Firstly, Is it possible to assign that list directly to the data grid view? If not then I'm converting that list into Dataset and binding to the Grid but the problem is, Collection List contains thousand of records and converting into Dataset decrease the performance.
Also, This is a direct bing with List or the Dataset to Gridview so is it possible to achieve the paging including First, Previous, Next, Last and Page sets?
Your help would be appreciated.
Thank you in advance for the help!
Dhaval
I dont think you can 'directly' do it but somehow , theres a way. Here is a question of the same matter.
Gridview using a generic list as DataSource and Auto-generating columns

Easy way to replace Data with ComboBox? Or populate ComboBox from Data

I took over a very old project written in VB6, it's a mess and I don't really know VB so it would be great if someone could help me.
I have a Data control which gets records from an Access database which I would like to replace with some kind of drop down list - I thought about ComboBox. Unfortunately I cannot get records from the database in the same way as with Data, so I thought about populating ComboBox based on what's in the Data control. How can I achieve it? Or is there a better way to do it?
My last resort is to create all database methods manually in order to replicate Data's behaviour for ComboBox but I think it's too much effort for such a small change.
Thanks in advance!
The Data control does more than just let them browse through the records, it manages the database, current record, data binding, etc.
The easiest way to do what you want is to hide/move the data control and use its .Recordset.Find*() methods.
Note that DAO is archaic and has been supersceded at least once for VB6 (with ADO)

Unbound Data Grid View

I have been trying to find a solution for this for a while but I've only managed to find junk on outdated forums.
I am using VB6 and I want to display data in a tabular form. I thought about using a DataGrid but I can't figure out how to add rows to the grid.
Note: The DataGrid is not bound to a recordset.
Is there any way to add the data to the GridView without storing it in a recordset. And is there a better VB6 control to use in this situation?
DataGrids are designed to be used bound to a data source, though it can be a custom data source object and not just an ADO Recordset.
For general display you might want to use the MSHFlexGrid (or the VB5 holdover MSFlexGrid).

Other options for creating table in ASP.NET

I am creating a huge html table using StringBuilder in the code behind, based on various search criterias selected by the user. The logic is complex as I have to create sub heading, nested tables etc. and it is really hard to maintain or modify. Is there a better way to deal with such kind of problems?
Thanks!!
All ASP and Html controls are encapsulated in classes. You're interested in the Table class (for ASP) and HtmlTable for the more light-weight, html-only class.
If I had to choose, I'd go for the html one, unless you want to add server-side events to the table.
A few years ago I was in the same situation. The problem included dynamic columns, subheadings, cells, everything. A typical table would be around 1000 rows and 50 columns (that's 50,000 cells!). The original implementation used a GridView and performed horribly. I rewrote the view to use a Repeater, a very light-weight looping control, with Literal controls. That reigned in a bit of the madness vs. 100% StringBuilder. I combined that with a bunch of static methods which returned string representations for standard html bits (kind of like ASP.NET MVC's "html helpers"), as well as keeping the object model completely isolated. It was all very fast (I forget, but I think the way the Repeater and Literal controls are rendered is directly to the response stream, so performance was comparable to StringBuilder, perhaps even better).
Even the above will be complex, and is akin to your own approach. But the key to maintaining sanity is to keep the different pieces separate (object model, html generation, and dynamic binding). It's almost like building your own ad-hoc framework. But for serious jobs like this, you need to get nitty-gritty when confined to web browsers.
There's always the built in native ASP.NET Table control
http://www.w3schools.com/aspnet/control_table.asp
GridView, ListView, DataList, Table e&.

Ideas for Quick Hierarchical Listing - .NET

I have a table in SQL Server listing corporate departments and their sections and subsections (3 levels). I would like to create some web-based listing of this, but similar to a TreeList.
I was thinking to set up nested Ajax Accordions, but it was taking me way too long to put together. I would even settle for a GridView with non-repeating column values.
Is there a way I can implement my idea without it taking me more than an hour or so for a newbie to complete? Any controls in ASP.NET or Ajax I can bind to would be great.
Thanks to Ozzy, I was able to solve this simple issue using a TreeList. Since my issue is simlper than the one in the tutorial he supplied, all I did was create DataTable for each level, and for each row I added the TreeNode (which was simply the string value of that entry). Thanks!!

Resources