I have Custom Data class which stores data about single customer and then i
store that customer objects in arraylist as shown below.
Customer custdata = null; // Custom Data class for 1 customer data.
ArrayList ar = new ArrayList(); // To store more than one customer
object.
for (int x = 0; x < 30; x++)
{
custdata = new Customer();
custdata.Custom erID = 1234 + x;
custdata.Custom erName = "Name" + x.ToString();
custdata.Custom erLocation = "UK " + x.ToString();
custdata.Custom erType = x.ToString();
ar.Add(custdata );
}
grid.; /// FEW Steps are missing and not sure to make it compatable to Grid.
grid.DataBind() ;
Now i want to bind data to gridView control, just like as we do if it was
Datatable.
Is there any simple conversion possible?
I do not want to use DataSet or DataTable but collection of Customer Objects
in Arraylist.
Thanks in advance.
-Vineet 3 9578
Vineet,
The easiest way is to use Eval method. In the code assign grid.DataSource =ar
and in the aspx page use databinding expressions like
<td><%# Eval("Name") %></td>
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"vineetbatt a" <vi*********@di scussions.micro soft.comwrote in message
news:0B******** *************** ***********@mic rosoft.com...
>I have Custom Data class which stores data about single customer and then i
store that customer objects in arraylist as shown below.
Customer custdata = null; // Custom Data class for 1 customer data.
ArrayList ar = new ArrayList(); // To store more than one customer
object.
for (int x = 0; x < 30; x++)
{
custdata = new Customer();
custdata.Custom erID = 1234 + x;
custdata.Custom erName = "Name" + x.ToString();
custdata.Custom erLocation = "UK " + x.ToString();
custdata.Custom erType = x.ToString();
ar.Add(custdata );
}
grid.; /// FEW Steps are missing and not sure to make it compatable to
Grid.
grid.DataBind() ;
Now i want to bind data to gridView control, just like as we do if it was
Datatable.
Is there any simple conversion possible?
I do not want to use DataSet or DataTable but collection of Customer
Objects
in Arraylist.
Thanks in advance.
-Vineet
Hi Eliyahu,
Is there any way we can use properties like Data member/ Data Key on grid
object just like for DataTable or DataSet?
I want to retain aspx code like
<Columns >
<asp:BoundFie ld DataField = "CustomerID " HeaderText = "ID" />
<asp:BoundFie ld DataField = "CustomerNa me" HeaderText = "Name" />
<asp:BoundFie ld DataField = "CustomerLocati on" HeaderText =
"Location" />
</Columns>
Thanks
"Eliyahu Goldin" wrote:
Vineet,
The easiest way is to use Eval method. In the code assign grid.DataSource =ar
and in the aspx page use databinding expressions like
<td><%# Eval("Name") %></td>
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"vineetbatt a" <vi*********@di scussions.micro soft.comwrote in message
news:0B******** *************** ***********@mic rosoft.com...
I have Custom Data class which stores data about single customer and then i
store that customer objects in arraylist as shown below.
Customer custdata = null; // Custom Data class for 1 customer data.
ArrayList ar = new ArrayList(); // To store more than one customer
object.
for (int x = 0; x < 30; x++)
{
custdata = new Customer();
custdata.Custom erID = 1234 + x;
custdata.Custom erName = "Name" + x.ToString();
custdata.Custom erLocation = "UK " + x.ToString();
custdata.Custom erType = x.ToString();
ar.Add(custdata );
}
grid.; /// FEW Steps are missing and not sure to make it compatable to
Grid.
grid.DataBind() ;
Now i want to bind data to gridView control, just like as we do if it was
Datatable.
Is there any simple conversion possible?
I do not want to use DataSet or DataTable but collection of Customer
Objects
in Arraylist.
Thanks in advance.
-Vineet
Provided you set grid.DataSource =ar, your example should work.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]
"vineetbatt a" <vi*********@di scussions.micro soft.comwrote in message
news:54******** *************** ***********@mic rosoft.com...
Hi Eliyahu,
Is there any way we can use properties like Data member/ Data Key on grid
object just like for DataTable or DataSet?
I want to retain aspx code like
<Columns >
<asp:BoundFie ld DataField = "CustomerID " HeaderText = "ID" />
<asp:BoundFie ld DataField = "CustomerNa me" HeaderText = "Name" />
<asp:BoundFie ld DataField = "CustomerLocati on" HeaderText =
"Location" />
</Columns>
Thanks
"Eliyahu Goldin" wrote:
>Vineet,
The easiest way is to use Eval method. In the code assign grid.DataSourc e=ar and in the aspx page use databinding expressions like
<td><%# Eval("Name") %></td>
-- Eliyahu Goldin, Software Developer & Consultant Microsoft MVP [ASP.NET]
"vineetbatta " <vi*********@di scussions.micro soft.comwrote in message news:0B******* *************** ************@mi crosoft.com...
>I have Custom Data class which stores data about single customer and then i
store that customer objects in arraylist as shown below.
Customer custdata = null; // Custom Data class for 1 customer data.
ArrayList ar = new ArrayList(); // To store more than one
customer
object.
for (int x = 0; x < 30; x++)
{
custdata = new Customer();
custdata.Custom erID = 1234 + x;
custdata.Custom erName = "Name" + x.ToString();
custdata.Custom erLocation = "UK " + x.ToString();
custdata.Custom erType = x.ToString();
ar.Add(custdata );
}
grid.; /// FEW Steps are missing and not sure to make it compatable to
Grid.
grid.DataBind() ;
Now i want to bind data to gridView control, just like as we do if it
was
Datatable.
Is there any simple conversion possible?
I do not want to use DataSet or DataTable but collection of Customer
Objects
in Arraylist.
Thanks in advance.
-Vineet
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: pmud |
last post by:
Hi,
I am using teh following code for sorting the data grid but it doesnt work.
I have set the auto generate columns to false. & set the sort expression for
each field as the anme of that field... This grid displayes results based on
users search..
public static int numberDiv;
private void Page_Load(object sender, System.EventArgs e)
{
|
by: yaniv abo |
last post by:
Hello.
How can I bind a list of objects to a DataGird?
I have a custom collection of Customer class
|
by: Alpha |
last post by:
I have several textboxes that I need to chang the text when the selection row
is changed in a datagrid. I have the following code. This textbox displayes
the initial selection but when I click on different rows in the datagrid, the
textbox content doesn't change to reflect the change. How can I address
this?
Also, If the user change the text in the textbox then how do I refesh the
display in the datagrid to reflect the changes?
...
|
by: Steve |
last post by:
Hi
I have a db with 2 tables that I want to bind to a grid depending on a
selection in a Dropdownlist
Also I want to be able to select a row from the gris to fill some
textboxes.
The databases are static in that they will not be updated they are just
for viewing
I have everything working but not to perfection
|
by: coleenholley |
last post by:
I have a Class Module written in VB that calls an RPC (written in COBOL) we have written code to read the data from the RPC, and we create a temporary datatable to store the data from the RPC. This works fine when we call the datatable and bind it to a data grid using datagridname.DataBind(), but I have an ASP table, with calculations using tbl_name.row(1).cells(1) and the result of the calculation is put in a specific row and cell.
I have...
| |
by: pmud |
last post by:
Hi,
I have a web page (asp.net, code:c#). I havean html table with text boxes.
Based on the user input , records are displayed in the data grid below it.
Now the datagrid has a large no. of columns. & depending on what the user
enters, the data grid can grow very large. So to avoid scrolling the whole
page, I just want the data grid to be scrollable. For this I used the <div>
tags around the data grid,
<div...
|
by: gordon |
last post by:
Hi
I have some standard text book type examples of oleDB connections and
routines that populate a list box with data with a query on an Access
database.
What I would like to do is to use a datagrid view instead as the information
in the listbox is very unattractive.
would anyone be kind enough to share some code that can use the result of
|
by: Amritha.Datta |
last post by:
I want to update MDIChild grid control by setting a datasource. How
does it possible from parent form?
In other words, I have a data grid control on a MDIChild form. I am
binding the data source from datagrid at the time of loading the MDI
Child.
Now, I need to refresh the data grid when there is a button click
happens on the parent form. I do not want to load the complete MDI
child again. I just want to update or refresh the data...
|
by: insirawali |
last post by:
Hi all,
I have this problem, i need to know is there a way i cn use the data
adapter's update method in this scenario.
i have 3 tables as below
create table table1{
id1 int identity(1,1)
Constraint pk_table1 Primary Key,
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |