Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 20th, 2008, 10:35 AM
Authorized User
 
Join Date: Sep 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
Default change value of code behind variable via Java Scri

I need to change the value declare in aspx.vb via javascript my code is like this

//// My Custom Image Class /////

Public Class imageClass Inherits System.Web.UI.WebControls.Image

Public imageLabel As String = ""

End Class

/////// Default.aspx.vb ////////

Protected Overrides Sub OnInit(ByVal e As EventArgs)

Dim picture As imageClass = New imageClass

pholder.Controls.Add(picture)
/// THIS SHOULD CHANGE VIA JAVASCRIPT///
picture.imageLabel = "LabelOne"

picture.Attributes.Add("onclick","javascript:click 1('" & picture.ClientID & "')")

End Sub

Protected Sub Submit_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Submit.Click

Dim NewImage As imageClass = New imageClass
For Each con As Control In pholder.Controls
If TypeOf con Is imageClass Then
/// SHOW OLD VALUE DECLARE IN ASPX.VB ///
MsgBox(CType(con, imageClass).imageLabel)
end if
Next

End Sub

/////// Default.aspx ////////

<script type="text/javascript" >

function click1(id1){document.getElementById(id1).setAttrib ute("imageLabel","Click");}

</script>

<html>
<body>
<form id="form1" runat="server">

<asp : PlaceHolder ID="pholder" runat="server" ></asp : PlaceHolder>

<asp : Button ID="Submit" Text="Submit" runat="server" />
</form>
</body>
</html>

Message Box shows the old value declare in aspx.vb, But I need the value changed by javascript function

thanks in advance






Similar Threads
Thread Thread Starter Forum Replies Last Post
Detect Variable change in C# tusharkale C# 1 July 8th, 2008 02:14 AM
ASSIGNING A JAVA SCRIPT VARIABLE TO A XSL VARIABLE SOMANATHAN10 XSLT 1 February 21st, 2007 04:26 AM
pass java variable to xsl variable kathy1016cats XSLT 1 June 14th, 2006 06:23 PM
Java Code - Wrox - Beginning JAVA - Ivor Horton ponguru Java Databases 3 May 18th, 2006 12:30 PM
how to view client registery values using php scri method PHP How-To 0 March 28th, 2006 10:57 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.