Dynamic Server Control event handling

Please support our ASP.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2007
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

 
0
  #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 12:11 pm. Reason: mistake correction
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: Dynamic Server Control event handling

 
0
  #2
Nov 24th, 2008
where is your txt_changed method? what is the problem?
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
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

 
0
  #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 5:32 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1,162
Reputation: dickersonka will become famous soon enough dickersonka will become famous soon enough 
Solved Threads: 137
dickersonka dickersonka is offline Offline
Veteran Poster

Re: Dynamic Server Control event handling

 
0
  #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 Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: Dynamic Server Control event handling

 
0
  #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.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Join Date: Sep 2007
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

 
0
  #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 Quick reply to this message  
Join Date: Jan 2008
Posts: 2,052
Reputation: serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light serkan sendur is a glorious beacon of light 
Solved Threads: 118
Featured Poster
serkan sendur serkan sendur is offline Offline
Postaholic

Re: Dynamic Server Control event handling

 
0
  #7
Nov 25th, 2008
yeah your best bet would be javascript.
Due to lack of freedom of speech, i no longer post on this website.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the ASP.NET Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC