473,503 Members | 9,887 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

asp.net 2.0 cant count?! help!

I have a detailsView (replaced the formview with it) thinking it would help
me fix my control access in a formview problem. Well, I don't think .net
knows how to count. Here is what I have:

I am trying to display the value of a certain cell in a label control. Say,
NewsId for my example. In this example, NewsId should be 14. I took this
line and used it to find out how many rows there were:
DateConfirmLabel.Text = EditNewsForm.Rows.Count.ToString();

I got 4. Ok no big deal. I want row 2, cell 2, so I wrote this:

DateConfirmLabel.Text = EditNewsForm.Rows[1].Cells.Count.ToString();

When I run it to see how many cells are in the row, I get index out of range
error when running the page. I found that it was the Rows[1] that was making
the problem. Any idea why this happens?


Jan 16 '08 #1
2 1105
you are probably trying to access the row before it has been added.
-- bruce (sqlwork.com)
"Andy B" wrote:
I have a detailsView (replaced the formview with it) thinking it would help
me fix my control access in a formview problem. Well, I don't think .net
knows how to count. Here is what I have:

I am trying to display the value of a certain cell in a label control. Say,
NewsId for my example. In this example, NewsId should be 14. I took this
line and used it to find out how many rows there were:
DateConfirmLabel.Text = EditNewsForm.Rows.Count.ToString();

I got 4. Ok no big deal. I want row 2, cell 2, so I wrote this:

DateConfirmLabel.Text = EditNewsForm.Rows[1].Cells.Count.ToString();

When I run it to see how many cells are in the row, I get index out of range
error when running the page. I found that it was the Rows[1] that was making
the problem. Any idea why this happens?


Jan 16 '08 #2
Never thought of that. I have an interesting question then. I have the
detailsView inside step 1 of a wizard. I need to transfer these BoundFields
into labels on step2 of the same wizard. Where would I put my code?
"bruce barker" <br*********@discussions.microsoft.comwrote in message
news:ED**********************************@microsof t.com...
you are probably trying to access the row before it has been added.
-- bruce (sqlwork.com)
"Andy B" wrote:
>I have a detailsView (replaced the formview with it) thinking it would
help
me fix my control access in a formview problem. Well, I don't think .net
knows how to count. Here is what I have:

I am trying to display the value of a certain cell in a label control.
Say,
NewsId for my example. In this example, NewsId should be 14. I took this
line and used it to find out how many rows there were:
DateConfirmLabel.Text = EditNewsForm.Rows.Count.ToString();

I got 4. Ok no big deal. I want row 2, cell 2, so I wrote this:

DateConfirmLabel.Text = EditNewsForm.Rows[1].Cells.Count.ToString();

When I run it to see how many cells are in the row, I get index out of
range
error when running the page. I found that it was the Rows[1] that was
making
the problem. Any idea why this happens?



Jan 16 '08 #3

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

Similar topics

0
1945
by: shan | last post by:
#include<fstream> #include<iostream> #include<string> #include<iomanip> #include<stdlib.h> #include<conio.h> #include<stdio.h> using namespace std; class library
16
1762
by: Mike Fellows | last post by:
when i load my windows form i populate a combobox i use the code below Dim conn As New System.Data.SqlClient.SqlConnection(strConn) Dim sql As String = "AllLenders" Dim da As New...
6
2443
by: Mr Newbie | last post by:
Whatever I do I cant programatically make my machine shutdown. I am using the following class and have tried both thte ExitWindowsEx and InititateSystemShutdownEx shared functions Neither seem to...
2
7367
by: g35rider | last post by:
Hi, I have the following code that is giving this error, I cant simplify the code, I was just testing some theory for something we are doing and was getting an issue here. Please someone point out...
0
3648
by: vinidimple | last post by:
Hi i have a serious problem while i was working in Excel.I want to fetch columns from an excel worksheet and i need to compare it with an sql querry fields,so i tried to open an excle...
0
941
by: riteshraha | last post by:
Hi everyone, I am a member of this forum. i have posted my problem repeatedly to this forum. but i cant get any reply from this forum. plz anyone make any reply of my problem. I cant retrieve...
3
2562
by: flavourofbru | last post by:
Hi all, I am reading a text file and then computing some values. Then I am closing that file. Later on if i reopened that file in the same program I am unable to read that file. I found that the...
4
1514
by: rez151 | last post by:
trying to create a tree of hash nodes, with each node having a max of 5 objects, and a maximum of 5 child nodes...we insert 6 sucesfully and "explode" to create 3 child nodes, but when it gets to 7...
5
1868
by: chevon1920 | last post by:
I am trying to do my assignment but I cant figure out how to get 8 data points per line to print to a file. Here is the assignment 1. Program asks the user to enter an odd number as a BASE,...
0
7207
marktang
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,...
0
7294
Oralloy
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,...
1
7015
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...
0
7470
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
4693
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3173
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1523
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 ...
1
749
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
403
bsmnconsultancy
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...

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.