Solved

FindControl created by jscript

Posted on 2004-09-02
1
256 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 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

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now