使用C#创建表单 [英] Creating Forms Using C#

查看:122
本文介绍了使用C#创建表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我是新手–编程和这个社区.最初,我是来这里浏览网络表单指南的,但是它并不能回答我所遇到的问题(或者我对它的解释不是很好!).
所以这是我的情况:我正在使用C#创建表单.该表单将在大型网站上作为单个页面存在,并将用于将文档上载到服务器.表单的文件应为.aspx,将提供源代码,但现在没有内容,并且我正在使用Microsoft Visual Studio 11 Express Beta for Web.该表格应具有文档代码,文档名称,父项和描述的数据输入区域(文本框).它还将具有按钮,允许用户保存,重新开始,附加文档,删除文档和取消.
听起来容易吗?我希望是这样,因为它对我而言不对,但也许会在几天……甚至几个小时内对我来说.
选择保存"按钮后,我应该使用什么代码将表单数据和文件上传到服务器?
删除文档"按钮和重新开始"按钮之间有什么区别(假设文件完全上传后反而会出现一个新页面).
我应该真的将其创建为网站页面,还是应该使用网络表单?

任何直接的帮助,指向教程的链接或指向电子书的链接,都将在不经解释的情况下被赞赏.到目前为止,我已经完成了(非常简单!)代码.谢谢!!

寂静之石



Hey guys,

I’m new – to programming and to this community. Originally, I came here looking at a guide for webforms, but it didn’t answer the questions that I had (or I didn’t interpret it very well!).
So here’s my situation: I’m using C# to create a form. The form will exist as a single page on a large website and will be used to upload documents to the server. The file for the form should be in .aspx, I will be provided the sourcecode, but have nothing now, and I’m using Microsoft Visual Studio 11 Express Beta for Web. The form should have data input areas (text boxes) for the Document Code, Document Name, Parent, and Description. It will also have buttons, allowing the user to Save, Begin Again, Attach Document, Delete Document, and Cancel.
Sound easy? I hope so, because it doesn’t to me –but maybe it will to me in a few days …or hours.

What code do I use to have the form data and the file uploaded to the server when the "Save" button is selected?
What’s the difference between the "Delete Document" button and the "Begin Again" button (assuming that a new page comes up anyway when a file has been completely uploaded).
Should I really be creating this as a website page or should I use a webform instead?

Any direct help, links to tutorials or links to ebooks would be appreciated beyond explanation. The (very skeletal!) code that I''ve done so far is below. THANKS!!

SilentStone



<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

    protected void TextBox1_TextChanged(object sender, EventArgs e)
    {

    }

    protected void Button3_Click(object sender, EventArgs e)
    {

    }

    protected void Button2_Click(object sender, EventArgs e)
    {

    }
</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        .newStyle1 {
            vertical-align: top;
        }
        .newStyle2 {
            vertical-align: top;
        }
        .newStyle3 {
            background-color: #920300;
            display: inline-block;
            line-height: 3px;
            border: thin solid #920300;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <div>

    </div>
    <asp:Panel ID="Panel1" runat="server" BorderColor="#FFFF66" BorderStyle="Solid"

        BorderWidth="3px" Width="800px" Wrap="False">
        <br />
        <br />
        <br />
        <strong>&nbsp; Document Code&nbsp;&nbsp; </strong>:
        <asp:TextBox ID="TextBox2" runat="server" style="margin-right: 0px"

            Width="506px" MaxLength="50"></asp:TextBox>
        <br />
        <br />
        &nbsp; <strong>Document Name &nbsp;</strong>:&nbsp;<asp:TextBox ID="TextBox3" runat="server"

            Height="16px" MaxLength="100" Width="177px"></asp:TextBox>
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <br />
        <br />
        &nbsp; Parent&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; :&nbsp;<asp:TextBox ID="TextBox6" runat="server"

            style="margin-left: 0px" Width="148px"></asp:TextBox>
        &nbsp;
        <br />
        <br />
        &nbsp; <span class="newStyle1">Description&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </span>&nbsp;<span class="newStyle2">:
        </span>
        <asp:TextBox ID="TextBox5" runat="server" Height="16px" Width="520px"></asp:TextBox>
        <br />
        &nbsp;
        <br />
        <br />
        <asp:Button ID="Button1" runat="server" Text="Save" />
        &nbsp;
        <asp:Button ID="Button2" runat="server" OnClick="Button2_Click"

            Text="Begin Again" />
        &nbsp;
        <asp:Button ID="Button3" runat="server" OnClick="Button3_Click"

            Text="Attach New Document" />
        &nbsp;
        <asp:Button ID="Button4" runat="server" Text="Delete Document" />
        &nbsp;
        <asp:Button ID="Button5" runat="server" Text="Cancel" />
        <br />
    </asp:Panel>
    </form>
</body>
</html>

推荐答案

 是什么意思?
Hi,What is the meaning of & nbsp ?


这篇关于使用C#创建表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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