0

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

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by MamathaS
0

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]
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.