Solved

NET 2.0 C# VS   GRIDVIEW  MANUALLY CREATE  ROWS

Posted on 2006-07-19
3
314 Views
Last Modified: 2008-03-17
I am working on a static ASP.NET mockup design (wireframes) which includes a gridview with a few sample records.

Right now I have no actual data and would like to simulate what  3 or 4 gridview records  would look like later with actual data?

How do you go about making  3 or 4 mockup records with say 4 columns of data to demonstate what the gridview would look with actual records?

Help

0
Comment
Question by:RSSIAdmin
  • 2
3 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 17142180
Are you bound to a DataTable/DataSet?  If so, then you can just add 3 or 4 blank rows, and bind the GridView.

Bob
0
 

Author Comment

by:RSSIAdmin
ID: 17146433
Not bound to anything

I just want to create 3 or 4 rows rows with some hard coded text in each row.

Something just to show in the gridview since I only have shell ( no datasource , in fact nothing)
     
MY sample GridView would look something like this:
             ticket_id      name    location
             003            Tom       NY
             005            Dick       Ca
            001            Harry      NJ
0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 17151036
You can create an in-memory DataTable, with columns ticket_id, name, and location, and add those three records:

VB.NET example:
Dim table As New DataTable
table.Columns.Add("ticket_id")
table.Columns.Add("name")
table.Columns.Add("location")

Dim row As DataRow = table.NewRow()
row("ticket_id") = "003"
row("name") = "Tom"
row("location") = "NY"

table.Rows.Add(row)

Me.GridView1.DataSource = table
Me.GridView1.DataBind()

Bob
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question