.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> ASP.Net >> Post New QuestionBookmark and Share Subscribe to Forum

very urgent!!!!!!!!!!!!!!

Posted By: shakspeare     Posted Date: August 27, 2008    Points:2   Category :ASP.Net
how to get value from dynamically generated textboxes when i click button

Responses
Author: Akhil Raj       [Moderator]      
Posted Date: August 27, 2008     Points: 5   

In the button click event use the following code

TextBox txt1 = (TextBox)Panel1.FindControl("TextBox1");
if(txt1 != null)
{
String txtvalue = txt1.Text;
}

U add the textbox control inside the panel. If not u can use
this.FindControl(...
or
Page.FindControl(...

Author: Santosh             
Posted Date: October 08, 2009     Points: 5   

hi shakspeare
Explain the Question Clearly,that is in Windows application or Web Application??

Santosh

Author: Lalij Mer             
Posted Date: January 29, 2010     Points: 5   

try this link

http://www.linkedin.com/answers/technology/web-development/TCH_WDD/596855-14364476

Please Check my answer if you help....
Thank You...

Lalit.
Author: Lalij Mer             
Posted Date: January 29, 2010     Points: 5   

use this code sample
using System;  
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class OpenWindow : System.Web.UI.Page
{
protected override void OnPreInit(EventArgs e)
{
base.OnPreInit(e);
AddRows();
}
void AddRows()
{
for (int x = 0; x < 10; x++)
{
TableRow tr = new TableRow();
TableCell tc = new TableCell();
CheckBox chk = new CheckBox();
if (x % 2 == 0) chk.Checked = true;
tc.Controls.Add(chk);
tr.Cells.Add(tc);
Table1.Rows.Add(tr);
}
}
protected void Page_Load(object sender, EventArgs e)
{

}


protected void Button1_Click(object sender, EventArgs e)
{
foreach (TableRow tr in Table1.Rows)
{
TableCell temp = tr.Cells[0];
CheckBox check = temp.Controls[0] as CheckBox;
Response.Write(check.ClientID+"-"+((check.Checked) ? "true" : "false")+"</br>");
}
}
}



Please Check my answer if you help....
Thank You...

Lalit.


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend