<%@ page language="c#" runat="server" %>
<script runat="server">
void page_load()
{
pi.text = math.pi.tostring();
exp.text = math.e.tostring();
}
void update(object sender, eventargs e)
{
try
{
double dblinput = convert.todouble(input.text);
sqrt_input.text = dblinput.tostring();
sqrt_result.text = math.sqrt(dblinput).tostring();
abs_input.text = dblinput.tostring();
abs_result.text = math.abs(dblinput).tostring();
log_input.text = dblinput.tostring();
log_result.text = math.log10(dblinput).tostring();
} catch {
sqrt_result.text = "";
abs_result.text = "";
log_result.text = "";
errormessage.text = "error occurred in input";
}
}
</script>
<html>
<head>
</head>
<body>
<hr />
pi = <asp:label id="pi" runat="server"></asp:label>
<br />
exponential constant = <asp:label id="exp" runat="server"></asp:label>
<hr />
<form runat="server">
input =
<asp:textbox id="input" runat="server"></asp:textbox>
<asp:button id="button1" onclick="update" runat="server" text="submit"></asp:button>
</form>
<hr />
square root of <asp:label id="sqrt_input" runat="server"></asp:label>= <asp:label id="sqrt_result" runat="server"></asp:label>
<br />
absolute value of <asp:label id="abs_input" runat="server"></asp:label>= <asp:label id="abs_result" runat="server"></asp:label>
<br />
logarithm of <asp:label id="log_input" runat="server"></asp:label>= <asp:label id="log_result" runat="server"></asp:label>
<br />
<asp:label id="errormessage" runat="server"></asp:label>
<br />
</body>
</html>