Text from a Dynamically generated TextBox in a Dynamically generated Table and Ajax


I have made an Ajax enabled asp page. I get a table when i click on a button. I dynamically create this table and show it using ajax. The Cells of the table contains TextBoxes. Now I have another button (Button2) which takes the text from the first textbox (id="text0") and displays it. The problem is this second button (Button2), it doesnt work correctly. That is, if I type something on the first textbox (text1) and click on the button2, it does not show me the change in the textbox.

This is the code for the button2 onClick event.

protected void Button2_Click(object sender, EventArgs e)
            int count = 0;
            Control ctl = new Control();
            ctl = (Control)Table1.FindControl("text0");
            Label1.Text = (ctl as TextBox).Text;

I would like to point out that the second button (button2) works on Ajax too. So I have 2 nested UpdatePanels. The outer update panel updates the table on clicking of Button1. The second one updates the Label1 (as shown in the code).

Any help would be greatly appreciated.

12/20/2008 12:33:14 AM
asp.net.ajax-discussion 13973 articles. 1 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 47


12/21/2008 12:09:10 AM


Was the TextBox generated dynamically? Where did you do the  dynamically generating process?

To reserve the value of it, we suggest you use control array to achieve creating controls dynamically in ASP.Net.


You can create another column to store the text property. Or you can also the control array object it in session.

Vince Xu
Microsoft Online Community Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
12/23/2008 3:55:14 AM

Similar Artilces:

applying ajax toolkit validation for dynamically generated javascript textboxes .. HELP
 hello friends...here is the ajaxtoolkit validation for a static aspx textbox....    <asp:TextBox ID="txtPlantDt1"  onkeypress="return keydown(this.id,event);" runat="server" Cssclass="textbox_add" Width="70px" style="text-align:justify" ValidationGroup="MKE" />                 <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender5" runat="server"       &n...

Dynamic table generation by JavaScript, Accessing row and data of dynamic table in C# code
  <div>   <input id="txtName" type="text"/> <input id="txtAdd" type="text"/> <input id="txtCity" type="text"/>   <input id="btnAdd" type="button" value="Add" onclick="AddClick();" /> <input id="btnRemove" type="button" value="Remove" onclick="RemoveClick(this);"/><br /> <table id="tblInfo" runat="server" style="width: 474px" > </table> </div&g...

How to get text from dynamically generated Textboxes
Hi, I have dynamically created textboxes to a panel and I want to read the text from them.I have used two buttons one for creating dynamic textboxes and other for reading the values the code is If Panel1.FindControl(String.Format("TB{0}", I)) IsNot Nothing Then  Dim myTextBox As TextBox = CType(Page.FindControl(String.Format("TB{0}", I)), TextBox) 'Label1.Text = myTextBox.Text  End If but it is not working. Can any one help Thanks,DSU Do a for each, Something like thisforeach (Control _control in this.Controls){if (typeof(_control) == System.Web...

How to generate Tabs dynamically under Ajax tabstrip??
 hi,i am totally new to Asp.net and Ajax.i am developing a application to generate tabs dynamically depending upon database values.i managed to get ajax tabstrip by using the following code.but i am not able to get tabs dynamically depending on database values.[i mean to say for ex: if database returns 3 values under a control,tabstrip should generate 3 tabs] <ajaxToolkit:TabContainer runat="server" ID="TabContainer1" Height="150px" CssClass=ajax__tab_xp>            <ajaxToolkit:TabPanel I...

Dynamically generated Button inside dynamically generated GridView inside ListView not firing Event
I've done tons of searching on this one to no real avail, so I'm posting here.  As a note, I've found multiple pages discussing this problem, but all of those solutions utilized a placeholder control, which I don't have the luxury of using.Here's a basic overview of what I have:A ListView ControlEmbedded into the ListViewItem is a GridView, utilizing a dynamically generated DataTable (due to a variable number of columns)A LinkButton in the footer of each GridView cell, which should fire an event to populate and show a Modal Dialog.The problem is that I can never get ...

generating the text boxes dynamically and binding this to table
hi, i have a table. and in that i have two rows(trs)in first row i have  two tds .In first td i have a textbox and in second td i have a button named "save"In second row (tr) i have only one td ........this td consists of a button named "add new row" if i click on the "add new row " button another row has to be  generated dynamically with textbox and button like first row. how can i do this using asp.net rameshgoudd: have a table. and in that i have two rows(trs)in first row i have  two tds .In first td i have a textbox and in second td i...

attaching AJAX extenders to dynamically generated controls
Is there a way to associate the dynamically generated controls to the AJAX extenders? Thanks Extenders can be dynamically created and its properties programmatically assigned, just like any other control. Dim myText as New TextBoxmyText.ID = "txtWhatever" 'Other properties...Dim myExt as New AjaxControlToolkit.FilteredTextboxExtendermyExt.TargetControlID = myText.ID'Other properties...When you ask a question, remember to click "mark as answered" when you get a reply which answers your question.My latest ASP.NET AJAX blog entries. thanks,can u please...

about dynamically generating table usin vb.net
How can i print dynamically generated table with some database values  (response.write(strTable)) Top of this page, click on the Learn menu item. JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue....

Dynamically generated report: Problem with generated table order when exporting to excel
Generated RDL file has N tables and N data sources. Each table is filled with its own data source. Table one is filled from data source one etc. When RDL file is generated order of tables is: Table 1, Table 2… as it should be. But when report is exported to excel file order of generated tables is not correct.  For example: N=4,       4 tables. RDL file:          Table 1Table 2Table 3Table 4 Excel file:          Table 3Table 4Table 1Table 2 All t...

AJAX + dynamic control generation on preRender = validators not working
Scenario:I have a dropdown (say drpTop) and an ajax updatepanel (say pnlMain) on the page along with submit button at the bottom. On selection of value in 'drpTop',  autopostback happens and corresponding controls are dynamically loaded into 'pnlMain'. These controls may include textboxes, text area and dropdowns. Also, corresponding validator controls are generated dynamically along with the controls. I have a summary validator at the top above 'drpTop', so that "ErrorMessage" property of each validator is shown in a bulleted list at the top and "...

How can i Use AJAX technology for dynamically generated server controls
Hi, Can any one help me to Achive AJAX tech. implementation for Dynamically generated server controls in asp.net 2.0(beta) version.My Codebehind, i am generating Server controls like Ctl01, Ctl02,Etc..Ctl01 is dropdownlist box ,onchange i neet to populate Ctl02(Label).text with database selected value based upon the Dropdownlist box selected index value..any coding idea?Thanks in Advance,Regards,Anbaz....

Generate Textboxes Dynamically
Hi, I've a textbox called MyTextBox in my form and I would like to generate 10 other  textboxes dynamically as an instance of Mytexbox that have the same events and properties.how can I do it -- Regards,M.Rochdibadis for (int i = 0; i < 10; i++){    TextBox blah = new TextBox();    blah.ID = "myTextBox_" + i;    blah.TextChanged += new EventHandler(myOriginalTextBox_TextChanged);    this.Controls.Add(blah);} http://www.singingeels.com/Articles/Dynamically_Created_Controls_in_ASPNET.aspx-Timothy Khourihttp:/...

Generating Dynamic Table
I'm trying to generate a table dynamically from a database (thumbnails of photos).  I am able to generate a table with only one record/cell per row but I'm not sure how I can add modify the table to output a specific number of cells (in my case 4) per row.  Here is my code for generating the table (I'm looping through a List<> object containing a custom Picture object): lstpic.ForEach(delegate(Picture pic)            {              &nbs...

how to generate textboxes dynamically
 I placed 5 textboxes in a row  in a panel on a asp.net web page .placed a button below this panel .and when the button is clicked i needed these 5 textboxes to be generated .and this event has to happen as many times the button is clicked.I needed the button click event in javascript. Take a look at the source code of this page:http://pascarello.com/examples/createElement.html You can add an onclick function to the button click from the code behind.MyBtn.Attributes.Add("onclick","myFunction(); return false;");Than on the clientside you would have to past...

Web resources about - Text from a Dynamically generated TextBox in a Dynamically generated Table and Ajax - asp.net.ajax-discussion

iPhone 5 A6 chip to dynamically up-clock up to 1.3GHz (and downclock too)?
Interesting video from our friends at TLDToday: If this is not just a Geekbench app glitch, it could indicate why that A6 processor is so 2X ...

Apple's Lightning port dynamically assigns pins to allow for reversible use
... a closer look at how Apple's new Lightning connector works, and has come to the conclusion that the 8 pins on each side of the plug are dynamically ...

iPhone 5 Lightning port dynamically reassigns pins
... of Apple's Lightning USB cable shows that the pins on the plug aren't arranged symmetrically, suggesting that the Lightning port can dynamically ...

Urlbox Launches Screenshots-as-a-Service Platform to Dynamically Update Galleries
... changes. Launched yesterday, Urlbox allows anyone with a gallery displaying website screenshots to automate the process and keep them dynamically ...

Everything.me launcher dynamically adapts to what you’re doing right now
... phone according to what you’re doing. Perform a search for ‘football’ and your background will change to the NFL logo. A launcher that dynamically ...

A YouTube Experiment Resizes the Player Dynamically
There's a new YouTube experiment that changes the video player's size, depending on the browser window's size. When resizing Chrome's window, ...

Apple Granted “Dynamically Changing Cursor for User Interface” Patent, Originally Filed in 2003
... a utility patent that covers the use of the mouse cursor that changes according to the context of the task it is engaged in. Called a “Dynamically ...

Atmel's FPSLIC II Dynamically Reconfigurable SoC Supports "Silicon-Sharing" For Peripherals & Interfaces ...
Silicon-Sharing Fits 200K Gate Design into 40K Gate FPSLIC II's, Cuts Power Drain by 97%

Everything.me Launcher Wants to Dynamically Change Phones Based on Location, Interests, and Mental State ...
What if your phone’s launcher dynamically changed based upon interests, your location, or topics you had in mind at a specific moment? A new ...

Resources last updated: 1/13/2016 5:30:00 AM