Creating Attribute/Calling Server VB.NET Function

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here's my problem.

I'm using a TreeView that doesn't have dblclick as an attribute. So I
attempt to create an attribute for that but using below code:

Me.tvEntities.Attributes.Add("onclick", "ExpandNode()")

This is code for ExpandNode() in client side:

<script language="VBScript" runat="server">
Private Sub ExpandNode(ByVal sender As Object, ByVal e As
System.EventArgs)
Textbox1.Text = "Hello!"
End Sub
</script>

For some reason, ExpandNode is not called. Did I write wrong code for
adding an attribute? Thanks in advance.
 
client code cannot call server code. you will have to use some postback
technique.

-- bruce (sqlwork.com)


| Here's my problem.
|
| I'm using a TreeView that doesn't have dblclick as an attribute. So I
| attempt to create an attribute for that but using below code:
|
| Me.tvEntities.Attributes.Add("onclick", "ExpandNode()")
|
| This is code for ExpandNode() in client side:
|
| <script language="VBScript" runat="server">
| Private Sub ExpandNode(ByVal sender As Object, ByVal e As
| System.EventArgs)
| Textbox1.Text = "Hello!"
| End Sub
| </script>
|
| For some reason, ExpandNode is not called. Did I write wrong code for
| adding an attribute? Thanks in advance.
 
Bruce, does this means that when you try to add an attribute using
attributes.add, it means it can only call client code (ie., no runat="Server"
for a script tag)? Is that why my code failed? 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