473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

ASp.net How to get textbox values generated byJavascript



You can use following code to get it work
<%@ Page Language="C#" AutoEventWireup="true"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>

<script type="text/javascript" >

function createTextBox(event)
{

//Get the reference of DIV where we want to show textboxes
var dv = document.getElementById("dvTextBoxes");

//Create the Textbox and append that to DIV.
var tx = document.createElement("INPUT");
tx.name = "txt";
tx.value= "1";
dv.appendChild(tx);
}
</script>
<script type="text/C#" runat="server" >

protected void Page_Load(object sender, EventArgs e)
{
try
{
if (Page.IsPostBack)
{
String strValues = Request.Form["txt"];

String[] strV = strValues.Split(',');

for (int i = 0; i < strV.Length; i++)
{
lblError.Text += strV[i].ToString() + "\n";
}
}
}
catch (Exception ex)
{
throw ex;
}
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="button" id="btnAddText" value="Add text" onclick="createTextBox(event)" />
<div id="dvTextBoxes">
</div>
<asp:Button ID="btnSubmit" runat="server" Text="Submit"/>

<asp:Label ID="lblError" runat="server" ForeColor="RED" ></asp:Label>
</div>
</form>
</body>
</html>
Reply me if you want some thing else
Thank you
Saandesh Daddi
www.sanshark.com

Aug 1 '08 #1
0 843

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: phil | last post by:
I'm having the same problem. Basically, what I need to know is - Can I move more than 4000 characters from a TextBox in a Web Form to a string? If so, some code that illustrates how to do this...
0
by: Paul Rees | last post by:
I am wondering if anyone has encountered a similar problem to the one that I am having. I have an ASP.NET page which has a table and a dropdownlist that was added at design time. The majority of...
0
by: Newasps | last post by:
Hi guys, I have a problem with UpdateCommand Event. In tihs event Ä°'m creating required controls to get that controls' values and also get them. But when I try to get updated values I'm getting the...
1
by: Kum | last post by:
Hi, I need help in asp.net dynamic textbox controls validation. I am creating textbox controls dynamically on a asp.net webpage. Now after creating the textboxes on the page I want to validate...
0
by: jason | last post by:
Hello everyone. I am trying to write some custom command events into a DataGrid. The command that is currently giving me trouble is an "Add" custom command in the footer of a template column. ...
11
by: Keith | last post by:
I apologize for those of you who think I'm posting on the same topic. It is not that I don't appreciate all of your comments - and I'm definitely reading them all - but I think I have a differing...
16
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString...
1
coolv
by: coolv | last post by:
Hello everyone, I m generating dynamic textbox depending on the value selected from the dropdownlist(DropDownList1_SelectedIndexChanged).eg: if i select 3 from dropdownlist,then 3 textbox...
2
by: mylog | last post by:
Hi all, I am having a small problem on getting the values of the dynamically generated textboxes in C# windows application. I have successfully read an xml file and put its key and value fields as...
0
by: Sandesh Daddi | last post by:
You can use following code to get it work <%@ Page Language="C#" AutoEventWireup="true"%> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.