Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

FindControl created by jscript

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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

In .NET 2.0, Microsoft introduced the Web Site.  This was the default way to create a web Project in Visual Studio 2005.  In Visual Studio 2008, the Web Application has been restored as the default web Project in Visual Studio/.NET 3.x The Web Si…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

877 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