Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

what is JavaScript correct syntax in my case?

Status
Not open for further replies.

ASPVB

Programmer
Jul 27, 2002
32
US
Hi there! Does somebody know how to do next:
Ok ! I have webForm with couple Web-Controls (evrething runat=server).I wish on click (on checkBox) form would not be sended to server but will exequte JavaScript function to disable rest of controls (exept checkBox itself) right on Client-side ! I don't want to use autoPostBack=true !!!!!

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
.....
.....
response.write (&quot;<script lang='js'>?????????</script>&quot;)
.....
.....
End Sub


Thanks!
 
I think that this thread will help you get on your feet with this problem.

thread855-523926

regards,
Brian
The problem with doing something right the first time is that nobody appreciates how difficult it was.
 
Yes it was very intresting!
I write down , JS work fine but now page does not submitet at all!
Is there something else ?

Thanks a lot !
 
OK !
here is my .aspx form: it is listBox =itemsfor choose,checkBox =add to cart,listBox=choosen items and submit button :

<%@ Page Language=&quot;vb&quot; AutoEventWireup=&quot;false&quot; Codebehind=&quot;WebForm1.aspx.vb&quot; Inherits=&quot;testASPNet2.WebForm1&quot;%>
<!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0 Transitional//EN&quot;>
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name=&quot;GENERATOR&quot; content=&quot;Microsoft Visual Studio.NET 7.0&quot;>
<meta name=&quot;CODE_LANGUAGE&quot; content=&quot;Visual Basic 7.0&quot;>
<meta name=&quot;vs_defaultClientScript&quot; content=&quot;JavaScript&quot;>
<meta name=&quot;vs_targetSchema&quot; content=&quot; </HEAD>
<body MS_POSITIONING=&quot;GridLayout&quot;>
<form id=&quot;Form1&quot; method=&quot;post&quot; runat=&quot;server&quot;>
<asp:Button id=&quot;Button1&quot; style=&quot;Z-INDEX: 100; LEFT: 219px; POSITION: absolute; TOP: 288px&quot; runat=&quot;server&quot; Width=&quot;102px&quot; Height=&quot;23px&quot; Text=&quot;Submit&quot;></asp:Button>
<asp:Label id=&quot;Label2&quot; style=&quot;Z-INDEX: 106; LEFT: 139px; POSITION: absolute; TOP: 187px&quot; runat=&quot;server&quot; Width=&quot;106px&quot; Height=&quot;24px&quot;>Choosen Item :</asp:Label>
<asp:CheckBox id=&quot;CheckBox1&quot; style=&quot;Z-INDEX: 101; LEFT: 176px; POSITION: absolute; TOP: 121px&quot; runat=&quot;server&quot; Width=&quot;101px&quot; Text=&quot;Add to cart&quot;></asp:CheckBox>
<asp:ListBox id=&quot;ListBox1&quot; style=&quot;Z-INDEX: 102; LEFT: 264px; POSITION: absolute; TOP: 44px&quot; runat=&quot;server&quot; Width=&quot;128px&quot; Height=&quot;61px&quot;>
<asp:ListItem Value=&quot;1&quot;>item #1</asp:ListItem>
<asp:ListItem Value=&quot;2&quot;>item #2</asp:ListItem>
<asp:ListItem Value=&quot;3&quot;>item #3</asp:ListItem>
<asp:ListItem Value=&quot;4&quot;>item #4</asp:ListItem>
</asp:ListBox>
<asp:Label id=&quot;Label1&quot; style=&quot;Z-INDEX: 104; LEFT: 171px; POSITION: absolute; TOP: 46px&quot; runat=&quot;server&quot; Width=&quot;69px&quot; Height=&quot;24px&quot;>Items to Choose :</asp:Label>
<asp:ListBox id=&quot;ListBox2&quot; style=&quot;Z-INDEX: 105; LEFT: 262px; POSITION: absolute; TOP: 181px&quot; runat=&quot;server&quot; Width=&quot;135px&quot; Height=&quot;76px&quot;></asp:ListBox>
</form>
</body>
</HTML>


And here my .aspx.vb form :

Public Class WebForm1
Inherits System.Web.UI.Page
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents CheckBox1 As System.Web.UI.WebControls.CheckBox
Protected WithEvents ListBox1 As System.Web.UI.WebControls.ListBox
Protected WithEvents ListBox2 As System.Web.UI.WebControls.ListBox
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents Label1 As System.Web.UI.WebControls.Label

#Region &quot; Web Form Designer Generated Code &quot;

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
End Sub

Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
'Here I just want to insert/add choosen items to second ListBox by javascript
'without sending to server
End Sub
End Class


So I need to get values from one List to another at client side !
Thanks for any idea !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top