RE: How to get value on postback Dynamically Created controls by javas

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Amit,

You can use Request.Form["App1"] (C#) or Request.Form("App1") (VB.NET) to
access values of controls created on the client side by javascript.

You may also want to create a hidden text field and update value of that
field with number of textboxes created on the client side.

Then retrieve this (hidden text box) value first on the server side for
count of fields created. Then use Request.Form("") to retrieve values of
textboxes created.

Regards,

Anand.

"Amit Maheshwari" wrote:

I have my aspx page on which i am creating <input type=text> on client side
using javascript. Now when i submit my page i need to access these controls
to get the value entered by the user.
the code is like
<script language="javascript">
<!--
//to count no of file upload controls
var intRowCount = 2;

function AddApp()
{
var strInner='';
var objTBody = document.getElementById('AppBody');

//creating columns
var objCell1 = document.createElement("TD");
var objCell2 = document.createElement("TD");
var objCell3 = document.createElement("TD");

//creating row
var objCurRow = document.createElement("TR");

objCurRow.appendChild(objCell1);

strInner = "<input type='text' id='App" + intRowCount +"' >";
objCell2.innerHTML = strInner;
//appending columns in the row
objCurRow.appendChild(objCell2);

strInner = "<input type='text' id='Desc" + intRowCount +"' >";
objCell3.innerHTML = strInner;
//appending columns in the row
objCurRow.appendChild(objCell3);

objCurRow.setAttribute("id","tr"+intRowCount);

//appending row in the TBody
objTBody.appendChild(objCurRow)

intRowCount = parseInt(intRowCount, 10) + 1;
}
-->
</script>

<input type="button" id="AddAppl" value="Add Application"
onclick="AddApp();">



.



Relevant Pages

  • Re: Ajax Library Question
    ... Are you saying that the OOP facade the the Ajax Library provides was/is ... controls emit code/data to the client and then the client would have OOP ... concentrates on dom modifications (what you typically do in javascript). ...
    (microsoft.public.dotnet.framework.aspnet)
  • RE: managing controls
    ... Your question is really about Javascript, and not about VB.net, because all ... > I'm using visual Basic .Net to make a web site and i'm having problems on ... > managing the controls contained in the web pages. ... > var Utilizador=0; ...
    (microsoft.public.dotnet.framework.aspnet.webcontrols)
  • Re: Performance question
    ... Keep in mind that all the menu controls, server generated or client ... will depend on the client allowing javascript. ...
    (microsoft.public.dotnet.framework.aspnet.buildingcontrols)
  • ASP.NET Listbox Client Side changes not reflected on page
    ... I am adding some values to the ASP.NET ListControl on the client side ... and this is not reflecting on the server side. ... Below is the javascript code, ... var listReomveFrom = document.getElementById("ctl00$MainContent ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: how to trim file path from filename
    ... on the client for making this split. ... Normally a server program would parse this kind of data. ... but that can be done using serverside javascript ... var url = 'http://aa.xx/bb/cc/dd.html '; ...
    (comp.lang.javascript)