Wrox Programmer Forums
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 27th, 2007, 04:14 AM
Authorized User
 
Join Date: Jun 2006
Posts: 47
Thanks: 0
Thanked 2 Times in 2 Posts
Default textchanged event

hi all
i have a placeholder.
In placeholder i m creating table and many rows and columns. in columns many cotrols.

one of them is textbox. now i want textchanged event of that textbox whose ID will be like "txt"+i where i is the number of times my loop exist.
                TextBox txtnxt1cons = new TextBox();
                txtnxt1cons.ID = "txtnxt1cons" + i;
                txtnxt1cons.AutoPostBack = true;

now wat to do...? pl help.....

Komila Sachdeva
Software Developer
Reliance engineering Associates (P) Ltd.
__________________
Komila Kalia
Software Developer
Reliance engineering Associates (P) Ltd.
 
Old July 29th, 2007, 12:32 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Default

man create an evernt, and add it to the txtnxt1cons.Onclick event.

Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"
 
Old August 5th, 2007, 06:13 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

i did not get your idea clearly what you expect how to access on chane event in these lines
?


thanks......
 
Old August 5th, 2007, 08:11 AM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 109
Thanks: 0
Thanked 0 Times in 0 Posts
Default

make it global :)

Nothing is impossible. The impossible only takes longer. "Digital Fortress, Dan Brown"
 
Old August 5th, 2007, 09:36 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

What you need to do is something like this:

for(int i=0;i<10;i++)
{
    TextBox txt = new TextBox();
    txt.ID = "txt" + i.ToString();
    txt.AutoPostBack = true;
    txt.TextChanged += new EventHandler(foo)
    //add textbox to container control
}

protected void foo(object sender, EventArgs e)
{
if(sender is TextBox)
{
     TextBox t = (TextBox)sender;
     //get the value of the changed text
     string foo = t.Text;
}
}

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old August 5th, 2007, 01:09 PM
Friend of Wrox
 
Join Date: Aug 2006
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

it sounds perfect

thanks......





Similar Threads
Thread Thread Starter Forum Replies Last Post
Event - Sender & Event args dash dev C# 2005 9 December 9th, 2007 07:24 AM
Programatically generating a "TextChanged" handler John Douglas C# 2 October 14th, 2006 05:36 AM
About Button event and Keydown event zhangxujun1981 XSLT 1 March 6th, 2004 04:59 AM
problem with textchanged event alyeng2000 ASP.NET 1.0 and 1.1 Basics 0 February 15th, 2004 05:24 AM
how to override an event with an event? blah VB.NET 2002/2003 Basics 5 November 13th, 2003 03:06 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.