AccorsAdusa
New Member
Hi folks:<BR><BR>I am new to ASp.Net and am struggling with a problem that I am hoping someone can please help me with. <BR><BR>I have a page with two frames. A user clicks a button in one frame to add an item to a shopping cart and this should update a running total of items in the shopping cart in the other frame. I was able to write a VBScript as follows to do this. The problem is that this script should run after the ASP code that updates the session variable that holds the number of items in the cart (explicitly linked to the onclick even in the button control).<BR><BR><script language="VBScript"><BR><BR>Sub AddtoCartbtn_onClick<BR> set win = top.frames(2)<BR> win.History.go 0<BR>End Sub<BR><BR></script><BR><BR>But I cannot seem to control the order in which this routine and the ASP code execute. <BR><BR>I tried to add the runat=server command to the VBSCript sub and call it from within the ASP code. But it now gives me the error message that "set and win assignment statements are no longer supported." What is the replacement for these statements?<BR><BR>Is there a way to ensure that the VBscript runs after the ASP code? Is there any other way to solve this problem?<BR><BR>Any help would be tremendously appreciated. Thanks a lot.<BR><BR>VivekVivek,<BR><BR>I don't know if I would use vbscript in this way. I think what you are trying to do might be better served using a client side javascript that gets rendered with your page:<BR><BR><script language=Javascript><BR>function buttonclick(id){<BR>window.location.frames[2].location = 'nameofyourotherpagehere.aspx?id=' + id;<BR>}<BR></script><BR>Then in your button add the onclick command and call that javascript. I like that way much better because your clients only have to support javascript 1.0.<BR><BR>However, I just read something in the documentation that I would have to play with. I think if you use a hyperlink button you can set the target. I haven't used it yet, but I am assuming that what that will do is create the client side javascript for you.<BR><BR>hth.