Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: Exercises on page 254 of Beg ASP.NET using VB.NET


Message #1 by "Carl E. Olsen" <carl-olsen@h...> on Sat, 5 Jan 2002 20:36:16 -0600
Greetings,



I working in the Beginning ASP.NET using VB.NET book, and having trouble

with exercise 4 on page 254.  I'm able to write an ASPX file that

accomplishes the desired result, but I can't figure out how to do it

without using JavaScript.  Is there a way to write the code using only

VB.NET?



Looking over chapters 1 through 7, I can't find any information that

would explain how to create a new button in a subroutine and then call

another subroutine to react to the new button click event by reloading

the page.



<script language="vb" runat="server">

Sub Call_Number(Sender As Object, e As EventArgs)

  if number1.Text <> "" then

  message1.Text = "<b>Calling " & number1.Text & "</b>"

  Call Disconnect

  end if

End Sub

Sub Disconnect()

  if number1.Text <> "" then

  message2.Text = "<input type=button id=reset1 value=Disconnect _

    onclick=window.location.replace('telephone.aspx') />"

  end if

End Sub

</script>

<html>

<head>

  <title>Virtual Telephone</title>

</head>

<body>

  <form runat="server">

  <asp:textbox id="number1" runat="server" />

  <asp:button id="submit1" text="CALL" onclick="Call_Number" _

    runat="server" />

  <asp:label id="message1" runat="server" />

  <asp:label id="message2" runat="server" />

  </form>

</body>

</html>



Carl Olsen, MCSE






  Return to Index