dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersMigbar
Abul Bashar Sardar
Shine S
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Forums » .NET » ASP.NET »

Specified argument was out of the range of valid values


Posted Date: 17 Jul 2012      Posted By:: Mahesh Ramgari     Member Level: Bronze    Member Rank: 3001     Points: 3   Responses: 3



for (i = 0; i < Table1.Rows.Count; i++)
{
TextBox t1 = new TextBox();
t1 = (TextBox)Table1.Rows[i].Cells[3].Controls[0];
}

when i am writing the above code, that time i am getting "Specified argument was out of the range of valid values" this type of error. in the Table1 have 3000 row values. how to get row wise cell values.




Responses

#680713    Author: jogesh      Member Level: Gold      Member Rank: 229     Date: 17/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

Your code looks fine, i think problem is with the data.

for (i = 0; i < Table1.Rows.Count; i++)
{
TextBox t1 = new TextBox();
t1 = (TextBox)Table1.Rows[i].Cells[3].Controls[0];
}

In the above code, check if you have 4 cells for each row and each cell has at least one control.



 
#680764    Author: Sunitha      Member Level: Silver      Member Rank: 883     Date: 17/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

your code is correct, but verify the column index. (Cells[3] means it is 4th column. So verify which column index you have given)
Hope this may be the reason for getting that error.


Regards,
Sunitha



 
#680770    Author: sreeraj      Member Level: Bronze      Member Rank: 4239     Date: 17/Jul/2012   Rating: 2 out of 52 out of 5     Points: 2

for (i = 1; i <= Table1.Rows.Count; i++)
{
TextBox t1 = new TextBox();
t1 = (TextBox)Table1.Rows[i].Cells[3].Controls[0];
}
Try this..row index starts from 1..
i m not sure...just try it






 
Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.



Next : How to set themes dynamically for different User in .Net..?
Previous : How can we use previous page postback property.
Return to Discussion Forum
Post New Message
Category:

Related Messages



Follow us on Twitter: https://twitter.com/dotnetspider

Active Members
TodayLast 7 Daysmore...

Awards & Gifts
Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.