473,394 Members | 1,703 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,394 software developers and data experts.

C# Find Text Boxes Grab Data

karenRoss
Hi!

Okay, here's the issue:

I have a nested repeater with this:
<td width="125px"><input type="text" name="M<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="10" maxlength="10"></td>
<td width="350px"><input type="text" name="C<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="50" maxlength="100"></td>

I need to search the page, find all the text boxes and get their values. However, I don't know anything about the ID other than it starts with a C or an M. I can't get a count from my initial data, so I query again to get the number of text boxes possible.

Even with a loop I cannot seem to actually "find" the objects. Any thoughts on any way to do this at all? foreach?
Aug 23 '07 #1
2 1958
Shashi Sadasivan
1,435 Expert 1GB
Hi!

Okay, here's the issue:

I have a nested repeater with this:
<td width="125px"><input type="text" name="M<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="10" maxlength="10"></td>
<td width="350px"><input type="text" name="C<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="50" maxlength="100"></td>

I need to search the page, find all the text boxes and get their values. However, I don't know anything about the ID other than it starts with a C or an M. I can't get a count from my initial data, so I query again to get the number of text boxes possible.

Even with a loop I cannot seem to actually "find" the objects. Any thoughts on any way to do this at all? foreach?
Hi karen,
what you have to do is get a list of all controls by this.controls, and check if they are a input type (if you can use asp .net controls it would be easier i suppose)

also refer to this site:
http://aspnet.4guysfromrolla.com/art...81402-1.2.aspx
Aug 24 '07 #2
Hi!

Okay, here's the issue:

I have a nested repeater with this:
<td width="125px"><input type="text" name="M<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="10" maxlength="10"></td>
<td width="350px"><input type="text" name="C<%# DataBinder.Eval(Container.DataItem, "combos_id") %>" size="50" maxlength="100"></td>

I need to search the page, find all the text boxes and get their values. However, I don't know anything about the ID other than it starts with a C or an M. I can't get a count from my initial data, so I query again to get the number of text boxes possible.

Even with a loop I cannot seem to actually "find" the objects. Any thoughts on any way to do this at all? foreach?
HI KAREN,
to get all the controls within a form, u can use

Controls oFormControls=this.Controls;
it returns all the controls on the form. but it better if u put all the textbox in groupbox or panel. then it'll iterate throw few controls.

//this code iterate throw all controls on the form
foreach (Control ctl in this.Controls)
{
if(ctl.GetType().Name== "TextBox")
{
if(ctl.Name="txtName")
string sName=ctl.Text;
}
}

//this code iterate throw all controls on the grpTextBox of the form

foreach (Control ctl in this.grpTextBox.Controls)
{
if(ctl.GetType().Name== "TextBox")
{
if(ctl.Name="txtName")
string sName=ctl.Text;
//do something
}
}


i think it resolve ur problem. if not or u want to know more about it, mail me to
[email removed]

!!! SHIPON !!!
Aug 24 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: John Kreps | last post by:
(acc 2002) I've got six unbound text boxes on a subform that has a white background. Each of those six boxes has an expression that when true, will change its background from white to another...
7
by: Aravind | last post by:
Hi folks. I have 2 forms, frmBorrow and frmHistory frmBorrow has an unbound multi-column combo box (cboMember) and 7 unbound text boxes (MemNo, MemName, MemIC, MemType, CourseFaculty, Borrow,...
14
by: simonmarkjones | last post by:
Hi, I'm having a bit of trouble editing an old database that was created quite a while ago by someone else. There is a form that lets the user select a member of staff and show details about the...
1
by: MattB | last post by:
I have a repeater control with text boxes in it that get built on the fly based on values in web.config. Now I need to grab the text from those boxes when the form is submitted. I can't just do...
2
by: Gary | last post by:
Hello All, I have an editable data grid in my web form, this grid allows the user to add new records, edit existing records and also delete them. When a user adds a record the grid goes in to...
7
by: Andrew McKendrick | last post by:
Hi, I've noticed a bug in VB.NET (latest .NET Framework)... - I have a TabControl on a form with several tabs. - Each tab contains text boxes that are bound to fields in a data source...
1
by: teddysnips | last post by:
I have an aspx form with 52 text boxes, each one representing a week. On another part of the form I have a further 7 text boxes, each representing a day of the week. I'd really like to be able...
10
by: Gerhard | last post by:
Hi, all I run into the same problem on Access 2000 and 2003. Hopefully someone can replicate it – or not. 1. Create an unbound form – call it Form1. 2. Insert two unbound text boxes –...
4
by: Andrew Meador - ASCPA, MCSE, MCP+I, Network+, A+ | last post by:
I have created a report. This report needs to display records between two dates entered by the user. I put two text boxes on the report so I can enter the start and end date - I set them to use an...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
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...

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.