Solved

FindControl created by jscript

Posted on 2004-09-02
1
270 Views
Last Modified: 2008-02-01
On the server side I have a table like this:
                                          <table id="tableLetter">
                                                <tr>
                                                      <td id="tdLettera">
                                                            <asp:TextBox runat="server" Width="100%" ID="LetteraRow10" MaxLength="110" onkeydown="myfocus(this)"></asp:TextBox>
                                                      </td>
                                                </tr>
                                          </table>



The myfocus(this) creates a new TextBox in jscript:
                  var lastTd = document.getElementById("tdLettera");
                  var obj = document.createElement("<input name='"+newID+"' type='text' maxlength='110' id='"+newID+"' onkeydown='myfocus(this)' style='width:100%;' />");
                  
                  lastTd.insertBefore(obj);
                  obj.focus();


When I click a button, I want go get the text of evry TextBox that I have created:
        If textBoxCodice.Text <> "" And textBoxOggetto.Text <> "" Then
            myTextBox = CType(FindControl("LetteraRow" + i.ToString()), TextBox)
            While Not myTextBox Is Nothing
                If Not myTextBox Is Nothing Then
                    Response.Write(myTextBox.Text)
                End If
                i = i + 1
                myTextBox = CType(FindControl("LetteraRow" + i.ToString()), TextBox)
            End While
        End If


But I can't find the controls created by java script.
Any idea?
0
Comment
Question by:fulgeru99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
Thalox earned 500 total points
ID: 11961785

this is because the created texboxes do not run at server, so you cant access them like the "real" textboxes.

but you can get their values from the

Request.Form - collection

something like

myTextBox = Request.Form("<TEXTBOXNAME>")


hope this helps


Thalox
0

Featured Post

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

632 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question