查询分配网页 [英] Enquiry Web page for assignment

查看:70
本文介绍了查询分配网页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一项任务,我必须创建的网页应该包含客户的询问,



页面应该在文本框中键入下面的信息。



姓名:

电子邮件:

联系方式:



应该有两个按钮。



提交并重置





一旦有人输入他的姓名,电子邮件和联系号码,点击提交按钮数据应该在文件或Excel中捕获



期待寻求帮助



请帮我编码。

解决方案

我们不做你的作业:这是有原因的。它就是为了让你思考你被告知的事情,并试着理解它。它也在那里,以便您的导师可以识别您身体虚弱的区域,并将更多的注意力集中在补救措施上。



亲自尝试,你可能会发现它不是和你想的一样困难!



如果你遇到一个特定问题,那么请问一下 - 但不要指望我们为你做这件事! / blockquote>

为了响应OP的评论,这里有一个关于ASP.NET表单的教程,它将帮助你获取数据

http://www.sitepoint.com/net-form-processing-basics/ [ ^ ]


您好我已经完成了示例代码经历并从中学习..



 <%@     Page    语言  =  C#    AutoEventWireup   =  true    CodeBehind   =  WebForm1.aspx.cs   继承  =  WebApplication1.WebForm1   %>  

< !DOCTYPE html >

< html xmlns = http://www.w3.org/1999/xhtml >
< head runat = server >
< title > < / title >
< script src = jquery.js.js > < / script >

< script type = text / javascript >



< / 脚本 >




< / head >
< body >
< <温泉n class =code-leadattribute> form id = form1 runat = server >


< table >
< tr >
< td > 名称:< / td >
< td >
< < span class =code-leadattribute> asp:TextBox ID = txtName runat = server > < / asp:TextBox > < / td >
< / tr >
< tr >
< td > E Mail:< / td >
< td >
< asp:TextBox ID = txtEmail runat = server > < / asp:Text框 > < / td >
< / tr >
< tr >
< td > 联系人:< / td >
< td >
< asp:TextBox < span class =code-attribute> ID = txtContact runat = 服务器 > < / asp:TextBox > < / td >
< / tr >
< tr >
< td c olspan = 2 >
< asp:按钮 ID = btnSubmit 文本 = 提交 runat = server OnClick = btnSubmit_Click / >
< asp:按钮 ID = btnReset 文本 = 重置 runat = server OnClick = btnReset_Click / >

< / td >
< / tr >
< tr >
< td colspan = 2 >
< asp:标签 ID = lblinfo runat = server > < span class =code-keyword>< / asp:Label >
< / td >
< / tr >
< / table > ;




< / form >
< / body >
< / html >













 使用系统; 
使用 System.IO;

命名空间 WebApplication1
{
public partial class WebForm1:System.Web.UI.Page
{



受保护 void Page_Load(对象发​​件人,EventArgs e)
{
}


受保护 void btnReset_Click( object sender,EventArgs e)
{
txtContact.Text = ;
txtEmail.Text = ;
txtName.Text = ;
lblinfo.Text = ;
}

protected void btnSubmit_Click( object sender,EventArgs e)
{
string contact = txtContact.Text;
string email = txtEmail.Text;
string name = txtName.Text;

string path = @ d:/file.txt;

if (!File.Exists(path))
File.Create(path);

使用(StreamWriter sw = File.AppendText(path))
{
sw.WriteLine( 联系人: + contact);
sw.WriteLine( 名称: + name);
sw.WriteLine( email: + email);
sw.WriteLine( ----------------- --------------------------------------------) ;
lblinfo.Text = 信息添加成功!;
}


}







}
}


Hi Everyone,

I have a assignment where i have to create the web page should contain enquiry of a customer,

Page should CAPTURE below information which is typed in the text box.

Name:
E-mail:
Contact:

Should have two buttons.

Submit and Reset


Once a person enters his Name, E-mail and Contact No, and clicks Submit Button data should get captured in a File or Excel

Looking forward for help

Please help me with coding.

解决方案

We do not do your homework: it is set for a reason. It is there so that you think about what you have been told, and try to understand it. It is also there so that your tutor can identify areas where you are weak, and focus more attention on remedial action.

Try it yourself, you may find it is not as difficult as you think!

If you get stuck on a particular problem, then please ask about that - but don't expect us to do it for you!


In response to the OPs comment here is a tutorial on ASP.NET forms which will help you "grab the data"
http://www.sitepoint.com/net-form-processing-basics/[^]


Hi I have done sample code just go through and learn from it..

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery.js.js"></script>

    <script type="text/javascript">



    </script>




</head>
<body>
    <form id="form1" runat="server">


        <table>
            <tr>
                <td>Name:</td>
                <td>
                    <asp:TextBox ID="txtName" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td>E Mail:</td>
                <td>
                    <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td>Contact:</td>
                <td>
                    <asp:TextBox ID="txtContact" runat="server"></asp:TextBox></td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click" />
                    <asp:Button ID="btnReset" Text="Reset" runat="server" OnClick="btnReset_Click" />

                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <asp:Label ID="lblinfo" runat="server"></asp:Label>
                </td>
            </tr>
        </table>




    </form>
</body>
</html>







using System;
using System.IO;

namespace WebApplication1
{
    public partial class WebForm1 : System.Web.UI.Page
    {



        protected void Page_Load(object sender, EventArgs e)
        {
        }


        protected void btnReset_Click(object sender, EventArgs e)
        {
            txtContact.Text = "";
            txtEmail.Text = "";
            txtName.Text = "";
            lblinfo.Text = "";
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            string contact = txtContact.Text;
            string email = txtEmail.Text;
            string name = txtName.Text;

            string path = @"D:/file.txt";

            if (!File.Exists(path))
                File.Create(path);

            using (StreamWriter sw = File.AppendText(path))
            {
                sw.WriteLine("Contact: " + contact);
                sw.WriteLine("Name: " + name);
                sw.WriteLine("email: " + email);
                sw.WriteLine("-------------------------------------------------------------");
                lblinfo.Text = "information added successfully !";
            }


        }







    }
}


这篇关于查询分配网页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆