datagrid.items.count = 0??

A

Anchorman

I've go the following data grid on my form:

<form id="form1" runat=server>
<asp:DataGrid
ID="DG"
AutoGenerateColumns="False"
EnableViewState="False"
MaintainViewState=False
HeaderStyle-BackColor=silver
HeaderStyle-ForeColor=#000090
HeaderStyle-HorizontalAlign="Center"
AlternatingItemStyle-BackColor="AliceBlue"
ItemStyle-BackColor="White"
CellPadding=3
Runat="Server">

<Columns>
<asp:TemplateColumn>
<headertemplate>
Rank
</headertemplate>
<itemtemplate>
<asp:textbox
id="Rank"
columns=2
maxlength=2
runat=server/>
</itemtemplate>
</asp:TemplateColumn>
<asp:BoundColumn
DataField="ActDesc"
HeaderText="Activity"/>
<asp:BoundColumn
DataField="Price"
DataFormatString="{0:c}"
ItemStyle-HorizontalAlign="Right"
HeaderText="Price"/>
</columns>
</asp:DataGrid>
<asp:button
id="SubmitBtn"
Text="Submit"
onClick="SubmitActivities"
runat=server/>
</form>

In SubmitActivities, DG.Items.Count returns 0 for some reasons. I'm using
the following code to check:

Response.Write(DG.Items.Count)
Response.End

Does anyone know what might be causing the problem?

Jesse
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top