Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

FindControl created by jscript

Posted on 2004-09-02
1
Medium Priority
?
271 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 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I have developed many web applications with asp & asp.net and to add and use a dropdownlist was always a very simple task, but with the new asp.net, setting the value is a bit tricky and its not similar to the old traditional method. So in this a…
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…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

670 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