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

problem in getting textbox id.

Hi boss,

In my page i am generating some text boxes dynamically on Button_click like this...


Expand|Select|Wrap|Line Numbers
  1. for (int i = 1; i <= cols; i++)
  2.         {
  3.             HtmlTableRow objRow = new HtmlTableRow();
  4.             HtmlTableCell objCell = new HtmlTableCell();
  5.             objCell.InnerHtml = "<td>ColumnName</td>" + 
  6. "<td><input id=\"txtColumnName"+i+"\" name=\"txtColumnName"+i+"\" runat=\"server\" type=\"text\" /></td>" + 
  7. "<td>ColumnWidth</td>" + "<td><input id=\"txtColumnWidth"+i+"\" name=\"txtColumnWidth"+i+"\" runat=\"server\" type=\"text\" /></td>";
  8.             objRow.Cells.Add(objCell);
  9.             objTbl.Rows.Add(objRow);
  10.         }
  11.         this.Controls.Add(objTbl);


but in another button_click I need to display the text entered in those text boxes , so i need to get the id's of those text boxes .
How can i get those textboxes ids.....can anybody give an idea...

Thanking you....
May 5 '09 #1
3 1247
wastman
17
I am also stuck with this concept.
particularly while assigning event handlers and calling event handlers back won't work.
May 5 '09 #2
Hamayun Khan
106 100+
First I think not sure that you cannot create server control like you are creating the textboxes.
Second what side i.e( in client script or server script ) you want to access the id.
May 5 '09 #3
Frinavale
9,735 Expert Mod 8TB
@Hamayun Khan
Vinod Allapu not actually creating Server Controls.
Vinod Allapu is dynamically creating HTML input elements and so the OP will naturally have a problem accessing these input elements in their server side code because HTML input elements are not server side controls.

Vinod Allapu,your other attempt at this problem is probably going to work better in the long run. Please take a look at your other thread.

You should probably do some more research into Templates, Templated Controls, and how to use templates with grid views. Also you should probably read up on how to use dynamic controls in ASP.NET also.
May 5 '09 #4

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

Similar topics

2
by: CDWaddell | last post by:
I have the following cod private void btnUpdate_Click(object sender, System.EventArgs e TextBox tbMembers = new TextBox() tbMembers = (TextBox) dlClubs.FindControl("tbMembers") string...
1
by: Amadelle | last post by:
Hi all and thanks in advance for your help, I have a problem with capturing the changed value of a text box in a datagrid. The datagrid is populated based on a dataset and I am using template...
2
by: Mike Collins | last post by:
I cannot get the correct drop down list value from a drop down I have on my web form. I get the initial value that was loaded in the list. It was asked by someone else what the autopostback was...
0
by: anandv81 | last post by:
Hi, I encountered a strange problem while working on an application, the problem goes like this. I am generating a few textboxes at runtime at the server side and added to a placeholder, a...
9
by: rn5a | last post by:
A Form has a DataGrid which displays records from a SQL Server 2005 DB table. Users can modify the records using this DataGrid for which I am using EditCommandColumn in the DataGrid. This is the...
1
by: Werner Schmidt | last post by:
Dear group, I have a very strange behaviour: In a loop there are several TextBoxes initialized: TextBox objTextBox = null; // one declaration for-loop // multiple initialisations
1
by: subhodey | last post by:
Hi, I am running a report in MS Access 2003, and it has some fields placed side by side. One of the fields is a textbox named "Title". In the property option of this textbox, the "Can grow" is set...
7
by: manas312 | last post by:
Hey guys.... I'm facing an interesting problem ....and need some solution..... The problem goes like this. You r having one site like www.abc.com (for example). The website contains only...
9
by: =?Utf-8?B?dHBhcmtzNjk=?= | last post by:
OK I have some Chinese text in sql server column that looks like this: 12大专题调研破解广东科学发展难题 This is unicode? Anyway, I put this data into a text area like this:...
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:
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
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
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
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,...
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...

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.