PC Review


Reply
Thread Tools Rating: Thread Rating: 2 votes, 3.00 average.

asp.net 2.0 cant count?! help!

 
 
Andy B
Guest
Posts: n/a
 
      16th Jan 2008
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?








 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      16th Jan 2008
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?
>
>
>
>
>
>
>
>
>

 
Reply With Quote
 
Andy B
Guest
Posts: n/a
 
      16th Jan 2008
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" <(E-Mail Removed)> wrote in message
news:ED9E3F0E-AEC9-42AE-9915-(E-Mail Removed)...
> 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?
>>
>>
>>
>>
>>
>>
>>
>>
>>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
count duplicats, display incremental count, restart count at changein value JenIT Microsoft Excel Programming 2 24th Aug 2010 09:10 PM
Count unique field1 combined with count field2, both grouped andungrouped john.mctigue@health.wa.gov.au Microsoft Access Queries 3 19th Dec 2008 03:52 AM
Count Employee Work Time - Don't Double-count Overlapping Apts. =?Utf-8?B?Sg==?= Microsoft Excel Worksheet Functions 0 27th Apr 2007 05:52 AM
how to get count(col1), count(col2), count(sol3) with only one query Mario Krsnic Microsoft Access Queries 2 27th Oct 2006 06:52 PM
Count Intervals of Filtered TEXT values in Column and Return Count across a Row Sam via OfficeKB.com Microsoft Excel Worksheet Functions 9 31st Jul 2005 03:37 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:21 AM.