473,322 Members | 1,431 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,322 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 944

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. ...
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"...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.