Hi

<%# ((DataRowView)Container.DataItem)["SomeProperty"] %>
<%# DataBinder.Eval(Container.DataItem, "SomeProperty")%>

From Google i figured out these can be used to bind the columns in GridView to ArrayList. But what is "some property" ?

For example i have a ArrayList in .aspx.cs as

static ArrayList componentSelectionArray = new ArrayList();

so can i just write in grid view to bind a arraylist to gridview columns as:

<asp:GridView ID= "GridView1" runat="server" AutoGenerateColumns="true">
<Columns>
<asp:TemplateField HeaderText="ComponentName">
<ItemTemplate>
<asp:Label ID="" text= "<%# DataBinder.Eval(Container.DataItem, "componentSelectionArray")%>" ></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</asp:GridView>

Please help me

Thank you in anticipation

Try this

<asp:GridView ID="dgViewTest" runat="server" AutoGenerateColumns="true">
<Columns>
<asp:TemplateField HeaderText="ComponentName">
<ItemTemplate>
<asp:Label ID="Test" runat="server" text="<%#Container.DataItem%>"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

From the code you need to bind the arraylist to the gridview.

static ArrayList componentSelectionArray = new ArrayList();

## your Array Initialization code come here

[B]_dgViewTest.DataSource = componentSelectionArray;
_dgViewTest.DataBind();[/B]
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.