George2
George2

Reputation: 45821

ASP.Net Grid view data filling issue

I am using VSTS 2008 + C# ASP.Net application type project. My requirement is, I want to let UI designer to work independently with business logics developer. Since UI designer (normally) do not know how to fill Grid View control using code to connect to database. So, my question is, if there are any ways to generate fake data for Grid View control without writing code to connect to database (special needs for UI designer -- to let UI designer have a feel of what data will look like when connecting database to facilitate designer's UI design work)?

Upvotes: 0

Views: 1332

Answers (3)

itchi
itchi

Reputation: 1713

You could create services marked with [dataobject] and [DataObjectMethodAttribute] that return datatables and dont require parameters. Depending on the size of data you could have these services return all records. It should be easy for the designers to select the service and bind to the grid view through the wizards. They'll also be forced to deal with paging, sorting and can also start to wire in some of the events such as onitemselecting.

In the past I've just allowed my UI designers to just work in HTML. I get them to mock out gridviews with regular tables that I just replace with gridviews when we wire the pages up to data. We typically have use cases or access to the client to determine what fields they want displayed on the gridview.

EDIT: My response took a few hours with kids running around the house.. :) I like the responses above. But, consider using an ado.net dataset and just exposing a default GetAll of the structure.

Upvotes: 1

eKek0
eKek0

Reputation: 23329

Why don't you generate a

List<Type>()

where Type is a class with the same structure as your real table(s), fill it with data and bind it to your gridview?

Upvotes: 3

user1921
user1921

Reputation:

You could also create your own DataTable in the code behind and populate it with whatever you want for your UI designer to play with.

How is this gridview going to be populated for deployment and do you not have a development database your UI designer could point to instead of using "fake" data? It's a simple thing to write a small bit of code to bind real data to the grid and would likely be more beneficial for the UI designer - it would allow them to potentially see and deal with pagination and sorting of the gridview.

You could also use a few dummy XML files to bind to the gridview - might be simpler/faster and would potentially allow you to switch them out to see different data.

As to the 50 different grid views you mentioned in a comment above, why not write a base class for the pages that will be rendering these views to inherit that handles all of your fake data generation?

Upvotes: 1

Related Questions