RSS Forums RSS

Dynamic Server Control event handling

Reply
Posts: 10
Reputation: vimalfor5 is an unknown quantity at this point 
Solved Threads: 1
vimalfor5 vimalfor5 is offline Offline
Newbie Poster

Dynamic Server Control event handling

  #1  
Nov 24th, 2008
Hi All,

Please help me to complete the following type of event handling in asp.net with C#

  1. private TableCell CreateTextCell(string name,string id)
  2. {
  3. TableCell cell = new TableCell();
  4. TextBox txt = new TextBox();
  5. txt.ID = id;
  6. txt.AutoPostBack = true;
  7. txt.Text = name;
  8. txt.TextChanged += new System.EventHandler(this.txt_Changed);
  9. cell.Controls.add(txt);
  10. return cell;
  11. }

My Problem is the TextChanged event is not calling or it is not properly handling.. the autopostback is working fine.. but the event handler not..
and one thing I'm using .net 1.1 version in VS2003

Please give me a suggestion

Vimal
Last edited by vimalfor5 : Nov 24th, 2008 at 11:11 am. Reason: mistake correction
AddThis Social Bookmark Button
Reply With Quote  
Posts: 1,413
Reputation: serkan sendur is an unknown quantity at this point 
Solved Threads: 69
Featured Poster
serkan sendur serkan sendur is online now Online
Nearly a Posting Virtuoso

Re: Dynamic Server Control event handling

  #2  
Nov 24th, 2008
where is your txt_changed method? what is the problem?
Serkan Sendur
All my helpful posts are dedicated to Marty Friedman, especially for his song Forbidden City.
Reply With Quote  
Posts: 10
Reputation: vimalfor5 is an unknown quantity at this point 
Solved Threads: 1
vimalfor5 vimalfor5 is offline Offline
Newbie Poster

Re: Dynamic Server Control event handling

  #3  
Nov 24th, 2008
Hi Serkan,

The code structure is like
PageLoad -> above method ->

  1. protected void Text_Changed(object sender,EventArgs e)
  2. {
  3. TextBox t1 =null;
  4. t1 = (TextBox)sender;
  5. ......
  6. ......
  7. }
Last edited by vimalfor5 : Nov 24th, 2008 at 4:32 pm.
Reply With Quote  
Posts: 1,157
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 133
dickersonka dickersonka is offline Offline
Veteran Poster

Re: Dynamic Server Control event handling

  #4  
Nov 24th, 2008
i believe when you are creating the controls dynamically like that, the control is not there that signaled the event

http://gregmckinley.com/cs/blog/arch.../09/29/27.aspx
Custom Application & Software Development
www.houseshark.net
Reply With Quote  
Posts: 1,413
Reputation: serkan sendur is an unknown quantity at this point 
Solved Threads: 69
Featured Poster
serkan sendur serkan sendur is online now Online
Nearly a Posting Virtuoso

Re: Dynamic Server Control event handling

  #5  
Nov 25th, 2008
ok, there is one big difference between .net framework 1.1 and 2.0, in 1.1 you have to wire the events to the methods in the page init event handler. Tell me what exactly you want to do with these table cells. Watch the execution order of events during the page cycle. that is the most typical problem for such issues.
Serkan Sendur
All my helpful posts are dedicated to Marty Friedman, especially for his song Forbidden City.
Reply With Quote  
Posts: 10
Reputation: vimalfor5 is an unknown quantity at this point 
Solved Threads: 1
vimalfor5 vimalfor5 is offline Offline
Newbie Poster

Re: Dynamic Server Control event handling

  #6  
Nov 25th, 2008
Hi

Actually i want to update some other cells + Some calculations also there whenever the dynamically created text field changed, thats the main thing i want to do. Coz the each and every cell in that page is dynamically created. I Have tried alot to do that Event handling.
I dnt want to use Ajax features in this app.
i knows the limitations of 1.1 and to 2.0 ...
Now i', trying the same thing with the JavaScript..
Reply With Quote  
Posts: 1,413
Reputation: serkan sendur is an unknown quantity at this point 
Solved Threads: 69
Featured Poster
serkan sendur serkan sendur is online now Online
Nearly a Posting Virtuoso

Re: Dynamic Server Control event handling

  #7  
Nov 25th, 2008
yeah your best bet would be javascript.
Serkan Sendur
All my helpful posts are dedicated to Marty Friedman, especially for his song Forbidden City.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.



Other Threads in the ASP.NET Forum
Views: 1452 | Replies: 6 | Currently Viewing: 1 (0 members and 1 guests)

 

Thread Tools Display Modes
Forums | Blogs | Tutorials | Code Snippets | Whitepapers | RSS Feeds | Advertising
All times are GMT -4. The time now is 3:43 pm.
Newsletter Archive - Sitemap - Privacy Statement - Acceptable Use Policy - Contact Us
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC