I've been working on a project which required the use of some javascript with some server-side controls. I spent considerable time monkeying around with the Page.ClientScript.RegisterClientScriptBlock() method which registers a client script on the page. I couldn't quite get it right using this method and ended up with a much simpler approach anyway. Every server-side web control has an "Add" method which you can use when the page loads. In the example below, I register a click event for a button and 2 different textboxes. Take notice that for the textboxes I use the client side id value for them (e.g. 'Header1_txtFirstName'). These values can be obtained by looking at the source code of the page in the browser.
Private Sub Page_Load(ByVal Src As Object, ByVal E As EventArgs)
If Not Page.IsPostBack Then
btnDelete.Attributes.Add("onClick", "return confirm('You sure you want to delete the record?');")
txtFirstName.Attributes.Add("onClick", "document.getElementById('Header1_txtFirstName').value = '';")
txtLastName.Attributes.Add("onClick", "document.getElementById('Header1_txtLastName').value = '';")
End If
End SubCandidate Name:
<asp:TextBox ID="txtFirstName" runat="server" Text="First Name" /> 'this becomes Header1_txtFirstName
<asp:TextBox ID="txtLastName" runat="server" Text="Last Name" /> 'this becomes Header1_txtLastName
More information on this topic here: http://dotnetslackers.com/articles/aspnet/JavaScript_with_ASP_NET_2_0_Pages_Part1.aspx