javascript - How to add client side OnClick actions to text in ASP.NET -


I am creating a table of contents in an asp.net page, and I am the customer side OnClick Action in each cell (the action must be set to the value of the named text box control for the text in the clicked cell). If I can add stuff directly to the HTML output, then I think I can do it in every cell with a line of JavaScript.

Given that I'm not now using JQuery (and never before), what is the easiest way to add it (spend learning content Including time)?


Edit: seems to work

Programmatic, you can set the HtmlTableCell's onclick client attribute by using HtmlControls:

  HtmlTableCell cell = new HtmlTableCell (); Cell.Attributes.Add ("onclick", "someFunction ();");  

However, if you are using jQuery, then you can do something like this:

  $ ('td'). Click (function () (/) select all table cells on the $. $ (This) .html ($ ('# textboxId'). Val ()); // When clicked, replace the internal HTML }); //  
with a textbox value

Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -