?
Solved

showing array results in a web form

Posted on 2007-03-24
9
Medium Priority
?
234 Views
Last Modified: 2013-11-07
Hi guys,

I need some help with showing an array in a aspx web page...

I want to post the results on to a web page. ....Could you please show me how to do these with a sample or resources....

 May be by writing strings of html with Response.Write

or

or using ASP.NET's Table and TableRow control

I dont know which one is better...or how to go about it..

i have this iteration in my code behind....

 wservices.NServices service = new wservices.NServices();

        Event[] eventArray = service.Get(222, null, null, null, null, new DateTime(2007, 4, 1), null,         33, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null,         null, null);

int i;
        for (i = 0; i < eventArray.Length; i++)
        {

            Object obj = eventArray[i];
         
        }
0
Comment
Question by:mrperfect75000
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
9 Comments
 
LVL 13

Accepted Solution

by:
KarinLoos earned 2000 total points
ID: 18786068
You might try converting the array to an arraylist .. Then simply bindng the arraylist to a gridview.
In your HTML put  Gridview control and then in code behind.
ArrayList eventArrayList= ArrayList.Adapter(eventArray);
Gridview1.Datasource = eventArrayList;
Gridview1.Databind().



0
 

Author Comment

by:mrperfect75000
ID: 18787408
Thanks! That seems to work after i added using System.Collections;  but i still get an error..

The name 'Gridview1' does not exist in the current context      

any idea why? I added the gridview to the aspx page...
0
 
LVL 13

Expert Comment

by:KarinLoos
ID: 18788695
1. doublecheck name  Gridview1 (c# is case sensitive).
2. check you have the runat=server in the html (ie <asp:Gridview id="grid" runat="server"..
If none of the above work. please post your html .
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:mrperfect75000
ID: 18788716
This is my html

 <asp:GridView ID="GridView1" runat="server" OnSelectedIndexChanged="GridView1_SelectedIndexChanged" Width="348px">
                </asp:GridView>
0
 
LVL 13

Expert Comment

by:KarinLoos
ID: 18788760
When are you getting the error regarding context, when trying to bind to the grid?
0
 

Author Comment

by:mrperfect75000
ID: 18788766
No, when assing the datasource

Gridview1.Datasource = eventArrayList;
0
 
LVL 13

Expert Comment

by:KarinLoos
ID: 18791532
Sorry to be a pain, however c# is case sensitive
in your above post :   Gridview1.Datasource = eventArrayList;  the v in Gridview is not with a capital v
and in your html example  <asp:GridView ID="GridView1" runat="server" OnSelectedIndexChanged ..
it is.

Try    GridView1.Datasource   .
0
 

Author Comment

by:mrperfect75000
ID: 18793302
Thanks!! That seems to have worked - thats so weird i spent almost 3 days trying to fix that!!  -

However i got another error - if you dont mind checking this one out please

Error      2      'System.Web.UI.WebControls.GridView' does not contain a definition for 'Datasource'      

any idea why i'm getting this one?
0
 

Author Comment

by:mrperfect75000
ID: 18793510
Ok - same problem - its working now ! thanks
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

764 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