Hi I am new to C# and I am trying to implement an example with relation to this website: http://www.devmanuals.com/tutorials/ms/aspdotnet/dropdownlist.html
What I have to do is to create web part & deploy it onto sharepoint: Code:
<%@ Page Title="" Language="C#" MasterPageFile="~/RoseindiaMaster.master"
AutoEventWireup="true" CodeFile="DropDownList.aspx.cs" Inherits="DropDownList" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.style3
{
color: #800000;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div>
<h2 style="color:Green">DropDownList in ASP.NET 4 , C#</h2>
<strong><span class="style3">Enter first number:</span>
</strong>
<br />
<asp:TextBox ID="txt1" runat="server" Text="12"/>
<br />
<br />
<span class="style3">
<strong>Enter second number:
</strong>
</span>
Logic code:
protected void drp1_SelectedIndexChanged(object sender, EventArgs e)
{
double firstno = Convert.ToDouble(txt1.Text);
double secondno = Convert.ToDouble(txt2.Text);
if(drp1.SelectedIndex == 1)
{
double add = firstno + secondno;
label1.Text = "Addition is :" + add;
}
I keep getting the error: txt1 is not recognized, Please advise, I am new to C#