Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 27th, 2007, 04:14 AM
Authorized User
 
Join Date: Jun 2006
Location: , , .
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.
Reply With Quote
  #2 (permalink)  
Old July 29th, 2007, 12:32 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Amman, , Jordan.
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"
Reply With Quote
  #3 (permalink)  
Old August 5th, 2007, 06:13 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
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......
Reply With Quote
  #4 (permalink)  
Old August 5th, 2007, 08:11 AM
Friend of Wrox
 
Join Date: Aug 2006
Location: Amman, , Jordan.
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"
Reply With Quote
  #5 (permalink)  
Old August 5th, 2007, 09:36 AM
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
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

================================================== =========
Reply With Quote
  #6 (permalink)  
Old August 5th, 2007, 01:09 PM
Friend of Wrox
 
Join Date: Aug 2006
Location: Bangalore, Karnataka, India.
Posts: 231
Thanks: 0
Thanked 1 Time in 1 Post
Default

it sounds perfect

thanks......
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 10:35 AM.


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