PC Review


Reply
Thread Tools Rating: Thread Rating: 1 votes, 1.00 average.

ASp.net How to get textbox values generated byJavascript

 
 
Sandesh Daddi
Guest
Posts: n/a
 
      1st Aug 2008


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

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
ASp.net How to get textbox values generated byJavascript Sandesh Daddi Microsoft ASP .NET 0 1st Aug 2008 02:56 PM
Dynamic generated TextBox Chen Sun via .NET 247 Microsoft ASP .NET 1 4th Jul 2004 06:44 AM
Assign Events to dynamically generated TextBox =?Utf-8?B?WmFyZG96?= Microsoft Dot NET Framework Forms 2 30th Jun 2004 01:05 PM
Binding a Textbox Generated dinamically Development Microsoft ASP .NET 0 21st Jan 2004 09:54 PM
Binding a Textbox Generated dinamically Development Microsoft ADO .NET 0 21st Jan 2004 09:48 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:32 AM.