473,657 Members | 2,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Loop through textboxes in a gridview

One of the columns in my gridview is a blank textbox (I have added it
as a template field). Users can enter a number in the textbox for a
multiple of the gridview records.

I have a submit button which is intended to use code behind to access
these textbox values and eventually add them to a database.

However, I can't seem to loop through the textboxes in the gridview
successfully and store their values. Does anyone know the right syntax
for accessing these textbox values using a For and Next statement?

Thank you.

Jul 26 '06 #1
2 3699
Loop through the gridview Rows collection. For every row find the textbox
with FindConrol method.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Steve" <ba****@iranman ia.comwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
One of the columns in my gridview is a blank textbox (I have added it
as a template field). Users can enter a number in the textbox for a
multiple of the gridview records.

I have a submit button which is intended to use code behind to access
these textbox values and eventually add them to a database.

However, I can't seem to loop through the textboxes in the gridview
successfully and store their values. Does anyone know the right syntax
for accessing these textbox values using a For and Next statement?

Thank you.

Jul 26 '06 #2
Could you please give me an example of the syntax to be used?
Eliyahu Goldin wrote:
Loop through the gridview Rows collection. For every row find the textbox
with FindConrol method.
--
Eliyahu Goldin,
Software Developer & Consultant
Microsoft MVP [ASP.NET]

"Steve" <ba****@iranman ia.comwrote in message
news:11******** **************@ i42g2000cwa.goo glegroups.com.. .
One of the columns in my gridview is a blank textbox (I have added it
as a template field). Users can enter a number in the textbox for a
multiple of the gridview records.

I have a submit button which is intended to use code behind to access
these textbox values and eventually add them to a database.

However, I can't seem to loop through the textboxes in the gridview
successfully and store their values. Does anyone know the right syntax
for accessing these textbox values using a For and Next statement?

Thank you.
Jul 29 '06 #3

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

Similar topics

4
18826
by: Kevin H | last post by:
Apologies in advance if this sounds slow-witted, but I didn't find it here. Need to populate some textboxes on a form. While I could hard code it (the number of options aren't that high), it would be more compact/efficient to use a loop. However, I haven't found anything that describes how to reference the textboxes sequentially ... evaluating the hard part of the textbox name, with the number of the loop iteration, to address the...
2
2526
by: staeri | last post by:
I have a GridView which dynamically creates text boxes. It could be between 1 and 100 textboxes depending on how many records there are in the database. I need to loop through all the text boxes and to calculate a sum of all of them which I put into a label in the grid. I give the text box the name "txtAmount" but the GridView renames each text box so I never really know the final name.
2
2780
by: lanem | last post by:
I have an asp.net 2.0 page with a couple of textboxes and a gridview. On postback from a rowcommand from the gridview, the textboxes are clearing out. No other postbacks from the page are causing this. There is NO code whatsoever that deals with these boxes. One of them is just a dummy I set up for troubleshooting. I type something in it and cause a postback from another control and the value is still there as it should be. Then, when...
1
1907
by: Kevin | last post by:
ASP.NET 2.0 I have code that updates a database from a number of textboxes on a web form. I've had to hard coded references to my web form textboxes. I'd like to know how I can reference them via a for next loop. For example, each time I give my command parameters a value I hard coded the textbox.text reference. cmd.Parameters.AddWithValue("@Rank", Me.ddlQ1.Text)
0
1115
by: ashish ranjan | last post by:
Hi all, I have to add a new row in footer of the gridview.All columns are bounded (value coming from table in database).But footer Should not be bounded And this footer row will have one "Add" Button And rest Textboxes for entring details of the corresponding column .Suggest me how i should proceed. Thanks in Advance, Ashish Ranjan
10
2935
by: fig000 | last post by:
HI, I'm new to generics. I've written a simple class to which I'm passing a generic list. I'm able to pass the list and even pass the type of the list so I can use it to traverse it. It's a generic list of business objects. I'm able to see that the type is the correct one in the debugger. However when I try to traverse the list using the type I can't compile. The same type variable I've verified as being passed
3
1904
by: Shawn | last post by:
I'm trying to go through a large number of logically named textboxes using a loop and cannot figure out how short of explicitly referencing every single one.
0
1050
by: adarshyam | last post by:
Hi, I am working on a web application in which user must be able to Open an Excel file from his computer and the contents must be displayed in TextBoxes in the form(each cells in excel to textboxes dynamically) not using gridview. somebody pls help me with code.. im trying this for the past 3days but no luck..
1
2033
by: Kalkin | last post by:
Hi I am having trouble with creating a gridview dynamically. Any help would be much appreciated. The Problem: I have a range of dates that changes, i want those dates to be the column headers and thus cannot create the columns in the asp page. Also under each column must be a textbox, or at the very least an editable label. How do i go about creating this gridview, or if anyone has any ideas as to how to do this another way i...
0
8420
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8324
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8740
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7353
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6176
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5642
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2743
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 we have to send another system
2
1733
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.