Textbox - additional features?

  • Thread starter Thread starter Rob T
  • Start date Start date
R

Rob T

I'm dynamically creating some textboxes but also need to add some javascript
into them. What properties do I use to do this?

txtTextBox = New TextBox
txtTextBox.ID = "CAS" & dv(cnt)("InvID")
txtTextBox.Text = dv(cnt)("Cash")
txtTextBox.Columns = 9
plhResults.Controls.Add(txtTextBox)

I need to add: onfocus="DoMyFunc();"

Thanks.
 
Add the function to the attribute collection.

txtTextBox.Attributes.Add( "onfocus", "javascript: DoMyFunc();" );

HTH,

bill
 
txtTextBox.Attributes.Add ("onFocus", "DoMyFunc();")

I'm dynamically creating some textboxes but also need to add some javascript
into them. What properties do I use to do this?

txtTextBox = New TextBox
txtTextBox.ID = "CAS" & dv(cnt)("InvID")
txtTextBox.Text = dv(cnt)("Cash")
txtTextBox.Columns = 9
plhResults.Controls.Add(txtTextBox)

I need to add: onfocus="DoMyFunc();"

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top