Ciao
Ho due codici che non vanno...
Sono gli esercizi di fine lezione..
Diciamo che i listati del capitolo vanno tutti ma quando arrivo sempre in fondo al capitolo alla fine trovo sempre qualcosa che non funziona..
Giro i codici con relativo errore:
Errore:codice:<%@ Page Language="VB" %> <script runat="server"> sub ChangeNames(obj as object, e as eventargs) if rlSex.SelectedIndex = 0 then ‘femmina lbNames.Items(0).Text = “Sally” lbNames.Items(1).Text = “Sara” lbNames.Items(2).Text = “Hope” lbNames.Items(3).Text = “Kaylee” else ‘maschio lbNames.Items(0).Text = “John” lbNames.Items(1).Text = “Chris” lbNames.Items(2).Text = “Daniel” lbNames.Items(3).Text = “Walter” end if end sub sub DisplayMessage(obj as object, e as eventargs) lblMessage.Text = obj.SelectedItem.Text & _ “ is a wonderful name!” end sub </script> <html><body> <form runat="server"> <asp:Label id="lblMessage" runat="server" /> Choose the sex of your baby: <asp:RadioButtonList id="rlSex" runat="server" OnSelectedIndexChanged=”ChangeNames” AutoPostBack="true"> <asp:ListItem>Female</asp:ListItem> <asp:ListItem>Male</asp:ListItem> </asp:RadioButtonList> Possible names: <asp:ListBox id="lbNames" runat="server" OnSelectedIndexChanged=”DisplayMessage” AutoPostBack="true"> <asp:ListItem></asp:ListItem> <asp:ListItem></asp:ListItem> <asp:ListItem></asp:ListItem> <asp:ListItem></asp:ListItem> </asp:ListBox> </form> </body></html>
Messaggio di errore del compilatore: BC30203: È previsto un identificatore.
Da errore nella riga 31: <asp:RadioButtonList id="rlSex" runat="server"
Errore:codice:<%@ Page Language="VB" %> <script runat="server"> sub Submit(obj as object, e as eventargs) if tbName.Text = “” then lblMessage.Text = “You forgot your name! ” end if if tbPhone.Text = “” then lblMessage.Text += “You forgot your phone! ” end if if tbEmail.Text = “” then lblMessage.Text += “You forgot your email! ” end if if lblMessage.Text = “” then lblMessage.Text = “Your information has been “ & _ “submitted!” end if end sub </script> <html><body> Please enter the following information. <asp:Label id=”lblMessage” runat=”server”/> <form runat=”server”> <table cellpadding=”2” cellspacing=”2” border=”1”> <tr> <td width=”250”>Name* </td> <td width=”150”> <asp:TextBox id=”tbName” runat=”server”/> </td> </tr> <tr> <td>Address</td> <td> <asp:TextBox id=”tbAddress” runat=”server”/> </td> </tr> <tr> <td>Phone* (area code first)</td> <td> <asp:TextBox id=”tbPhone” runat=”server”/> </td> </tr> <tr> <td>Fax (area code first)</td> <td> <asp:TextBox id=”tbFax” runat=”server”/> </td> </tr> <tr> <td>Email*</td> <td> <asp:TextBox id=”tbEmail” runat=”server”/> </td> </tr> <tr> <td colspan=”2”> <asp:Button id=”btSubmit” runat=”server” Text=”Submit” OnClick=”Submit” /> </td> </tr> </table> An asterisk (*) indicates a required field. </form> </body></html>
Messaggio di errore del parser: L'attributo Runat deve avere solo il valore Server.
Da errore nella riga 27: <asp:Label id=”lblMessage” runat=”server”/>
Grazie dell'attenzione..
Scusatemi ma devo assolutamente capire come funziona questo asp.net perchè ho diversi collaboratori che mi rallentano il lavoro e quindi stò cercando di organizzarmi per fare tutto da solo...
Thanks
Daniele

Rispondi quotando
