1.) It depends on if you want to update it on the server or the client. If it's on the server, then you could rebuild the param tags, but this wouldn't happen until the form is posted back to the server. If it's on the client, you would probably want to have event handlers for the textbox onblur or onchange events, then set the value via script code on the client.
2.) You could do this by dynamically building the object tag on the server. In your web form, you would probably want to do this by replacing the object tag with and leave it empty, then at run-time build up your object tag via HtmlTextWriter, and then set the value of the literal control from what you've built up in the HtmlTextWriter. For example:
Imports System.Web.UI
Imports System.IO
' ...
Dim buffer As StringWriter
Dim writer As HtmlTextWriter
Try
buffer = New StringWriter
writer = New HtmlTextWriter(buffer)
writer.AddAttribute(HtmlTextWriterAttribute.Id, "knob")
writer.AddAttribute("classid", "clsid:D940E4D2-6079-11CE-88CB-0020AF6845F6")
writer.RenderBeginTag(HtmlTextWriterTag.Object)
' :
' :
writer.AddAttribute(HtmlTextWriterAttribute.Name, "Value_21")
' NOTE: Add your custom parameter value here
writer.AddAttribute(HtmlTextWriterAttribute.Value, "0")
writer.RenderBeginTag(HtmlTextWriterTag.Param)
writer.RenderEndTag()
' :
' :
writer.RenderEndTag()
' Assuming that you had a LiteralControl member in your code-behind called literal:
literal.Text = buffer.ToString()
Finally
If Not buffer Is Nothing Then
Dim disposable As IDisposable = DirectCast(buffer, IDisposable)
disposable.Dispose()
End If
If Not writer Is Nothing Then
Dim disposable As IDisposable = DirectCast(buffer, IDisposable)
disposable.Dispose()
End If
End Try
3.) It's hard to come up with concise guidelines that can be explained in a few sentences, but in a nutshell it comes down to where do you need your logic to execute. In general you should prefer server controls, but when you need to do something that's specific to the client (for example, interactivity on the client such as changing the value of a control, updating the interface via client-side events, etc), you'll have to use client-side controls/code.
- Elton