Solved

FindControl created by jscript

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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Technology Resume 7 88
Code works but breaks when I add one section 4 35
Aspx calendar pop up control 3 38
Display Error Message in Asp.net Modal Validation Partial View 3 39
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…
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…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

738 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