473,320 Members | 1,961 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

datagrid.items.count = 0??

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

--
Jesse
www.davinci-mims.com
Nov 21 '05 #1
1 1825
Try set Page.EnableViewState Property, DataGrid.EnableViewState Property to
True

Nov 21 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know...
2
by: Alpha | last post by:
I have a window application. In one of the form, a datagrid has a dataview as its datasource. Initial filtering result would give the datavew 3 items. When I double click on the datagrid to edit...
4
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. ...
3
by: | last post by:
Hi, I have come across a situation which appears to be a BUG with the DataGrid control (asp:datagrid) Following the application of a fliter on a PostBack, it seems the total number of items...
8
by: Inigo Jimenez | last post by:
I have an ASP .net web application installed in a Windows 2003 server. This web application has a webform that has a Datagrid. This Datagrid is filled with the data of a SQL table. I have a...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
1
by: John Smith | last post by:
Any ideas why I wouldn't be able to return data from a cell within a datagrid? I am trying to get the value of a Cell within each Record by using dgrProduction.Items(i).Cells(2).Text But...
5
by: Coleen | last post by:
Hi all :-) We are using a DB2 database connection through a class module to get the data into a datagrid in an aspx web page using VB.Net. I can get the data into the first datagrid with no...
3
by: Richard | last post by:
In ASP.NET 1.1, I have SmartNavigation turned on so that the user's focus will remain on the line in the datagrid they choose to edit. When the user chooses to add a new line in the datagrid,...
0
by: JamesOo | last post by:
I have the code below, but I need to make it searchable in query table, below code only allowed seach the table which in show mdb only. (i.e. have 3 table, but only can search either one only,...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.