HighTechTalks DotNet Forums  

calling Javascript function for runtime webcontrols

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss calling Javascript function for runtime webcontrols in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
gmalai
 
Posts: n/a

Default calling Javascript function for runtime webcontrols - 02-07-2005 , 03:26 PM






Hello,

I am generating textboxes at runtime and adding to a table cell when a
particular IF condition is not satisfied. The visibility property of
the textboxes are set to false. When the user double clicks a
particular table cell, the textbox should become visible(this idea was
given by someone in this post). But I don't know how to proceed further
now. How can I access the ID of each runtime textbox and make it
visible in the javascript function? Where should the javascript
function be placed? I have whatever code I have till now below:


'c is the table cell
'r is the table row

Else ' if some condition is not satisfied here
Dim tb As New TextBox
tb.ID = "tb" + strdate ' make each textbox ID
unique
tb.Visible = False
c.Attributes.Add("ondblclick", "ShowTextBox();")

End If
r.Cells.Add(c) 'adds each cell to row
Next i

table1.Rows.Add(r) 'add the row to the table


Thanks,

Gayathri


Reply With Quote
  #2  
Old   
Gold
 
Posts: n/a

Default RE: calling Javascript function for runtime webcontrols - 02-08-2005 , 09:51 AM






Hi,

You can get the ID of the runtime controls by using the FindControl
method. this method returns the id of the control, using this id you can
attach a javascript fn at runftime.

controlname.Attributes.add("eventname","fn. to call")

Hope this will help...if u need more details..just post qry
"gmalai" wrote:

Quote:
Hello,

I am generating textboxes at runtime and adding to a table cell when a
particular IF condition is not satisfied. The visibility property of
the textboxes are set to false. When the user double clicks a
particular table cell, the textbox should become visible(this idea was
given by someone in this post). But I don't know how to proceed further
now. How can I access the ID of each runtime textbox and make it
visible in the javascript function? Where should the javascript
function be placed? I have whatever code I have till now below:


'c is the table cell
'r is the table row

Else ' if some condition is not satisfied here
Dim tb As New TextBox
tb.ID = "tb" + strdate ' make each textbox ID
unique
tb.Visible = False
c.Attributes.Add("ondblclick", "ShowTextBox();")

End If
r.Cells.Add(c) 'adds each cell to row
Next i

table1.Rows.Add(r) 'add the row to the table


Thanks,

Gayathri



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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.