Page 117 - DCAP312_WEB_TECHNOLOGIES_II
P. 117

Unit 6: Error Handling



                      </asp:DropDownList>                                                         Notes
                      <br />
                     <br />
                     <asp:Label ID= “lblquotes” runat= “server”>
                     </asp:Label>
                      <br />
                     <br />
                     <asp:HyperLink ID= “HyperLink1” runat= “server”
                     NavigateUrl= “mylink.htm”>Link to:</asp:HyperLink>
                      </div>
                     </form>
                     </body>
                     </html>

                     The Code behind File
                     public partial class _Default : System.Web.UI.Page
                     {
                     protected void Page_Load(object sender, EventArgs e)
                     {
                      if (!IsPostBack)
                     {
                     string[,] quotes =
                     {
                     { “Imagination is more important than Knowledge.”,
                      “Albert Einsten”},
                     { “Assume a virtue, if you have it not”,
                      “Shakespeare”},
                     { “A man cannot be comfortable without his own
                     approval”, “Mark Twain”},
                     { “Beware the young doctor and the old barber”,
                      “Benjamin Franklin”},
                     { “Whatever begun in anger ends in shame”,
                      “Benjamin Franklin”}
                     };
                     for (int i=0; i<quotes.GetLength(0); i++)
                     ddlquotes.Items.Add(new ListItem(quotes[i,0],
                     quotes[i,1]));
                     }
                     }
                     protected void ddlquotes_SelectedIndexChanged(object
                     sender,
                     EventArgs e)
                     {

                                             LOVELY PROFESSIONAL UNIVERSITY                                   111
   112   113   114   115   116   117   118   119   120   121   122