Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 3.5 > ASP.NET 3.5 Basics
|
ASP.NET 3.5 Basics If you are new to ASP or ASP.NET programming with version 3.5, this is the forum to begin asking questions. Please also see the Visual Web Developer 2008 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 3.5 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 5th, 2010, 10:27 PM
Authorized User
 
Join Date: Aug 2007
Posts: 11
Thanks: 0
Thanked 0 Times in 0 Posts
Default What kind technology do I need use based dynamic statement ?

What kind technology do I need use based dynamic statement in ASP.net with C#?
I hope the end user input dynamic statement with C# in TextBox1
For example1
int i = 5;
int j = 6;
int result = i * j - 2;


For example2
double d1 = 23.6;
double d2= 52.3;
double result=1.0;
for (int i = 1; i <= 2; i++)
{
result = result * d1 * d2;
}


then the result will be displayed when the user click Button1, how can do that? Thanks!

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
Input
<br />
<asp:TextBox ID="TextBox1" runat="server" Height="120px" TextMode="MultiLine" Width="192px"></asp:TextBox>
<br />
<asp:Button ID="Button1" runat="server" Text="Get Result" /></div>
</form>
</body>
</html>
__________________
Online Calculator - Online platform to create program with C# 4.0 and share with other people
 
Old February 9th, 2010, 09:22 AM
Friend of Wrox
 
Join Date: May 2006
Posts: 107
Thanks: 1
Thanked 8 Times in 7 Posts
Default

On your aspx page

Code:
<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default10.aspx.cs"Inherits="Default10" %>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<headrunat="server">
<title></title>
</head>
<body>
<formid="form1"runat="server">
<div>
<br/>
<asp:ButtonID="Button1"runat="server"onclick="Button1_Click"Text="Button"/>
<br/>
<br/>
<asp:LabelID="Label1"runat="server"Text="Label"></asp:Label>
</div>
</form>
</body>
</html>


and you code behind aspx.cs page

Code:
 
 
 
 
 
 
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
publicpartialclassDefault10 : System.Web.UI.Page
{
protectedvoid Page_Load(object sender, EventArgs e)
{
}
protectedvoid Button1_Click(object sender, EventArgs e)
{
Label1.Text = "Hello";
}
}


The button click will put the word hello onto the label

You need to build your code in to display the result instead of "Hello"
__________________
Try our latest project www.nobanx.com Currency Exchange for members





Similar Threads
Thread Thread Starter Forum Replies Last Post
dynamic compilation of class based on xsd vhrao .NET Framework 3.5 0 July 7th, 2008 03:53 PM
update multiple column based on case statement?? vinod_yadav1919 SQL Server 2000 6 July 3rd, 2008 07:29 PM
OLE Object based on If statement lryckman Access VBA 3 October 25th, 2005 02:40 PM
conditional statement based on attribute value dancbishop XSLT 2 November 7th, 2003 12:50 PM
Dynamic IF Statement fantom222 VB How-To 7 June 13th, 2003 09:16 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.