Creating Attribute/Calling Server VB.NET Function

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.
 
B

bruce barker

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.
 
G

Guest

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

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top