动态WebForm! [英] Dynamic WebForm!

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

问题描述

大家好。我最近被要求创建一个控制台应用程序,它接受文本文件的内容,并根据文本文件创建一个aspx格式的webform。例如,如果文本文件包含姓,文本框,姓氏,文本框"控制台应用程序将读取此文件并生成一个带有标签FirstName和LastName的webform以及一个文本框,以填充所需的信息。由于文本文件的内容可以更改,因此webfom也可以。我是c#的新手,你们给予的任何帮助都会有很多帮助。哦,它暗示我创建了一个测试网页,并将其用作模板..我不明白它是如何工作的。

解决方案

听起来像课程家庭作业。我们可以为课程做很多事情。


停止。考虑一下您的程序必须经历的步骤,然后确保您知道如何自己完成每个小部分。一旦你可以完成离散的小功能*然后*担心将它们组合在一起。


你能读一个文本文件吗?

你能不能分解内容在逗号?

你能根据拆解的文本文件将你的代码发送到不同的函数吗?

你能以编程方式将控件添加到网页文件吗?

你能确定那个控件的大小和位置吗?


非常感谢你的回复,我确实做了我的研究,并找到了如何阅读文本文件一次一个字。在阅读每个单词后,我想知道,我是否可以使用一系列if条件来确定要添加到网页的控件类型。例如 if(word ==" text"){* add control to display textbox *}。我正在思考这些问题。这是一个可行的想法还是不行?


一系列if陈述会起作用。那么切换也是如此。构造

Hi guys..I was recently asked to create a console application that takes the content of a text file and creates a webform in aspx format based on the the text file. For example if the text file contains " FirstName,TextBox,LastName,TextBox" the console application would read this file and produce a webform with the labels FirstName and LastName and a text box to entire the desired information. Since the contents of the text file can change so can the webfom. I am new to c# and any help you guys can give would help alot. Oh it was hinted that I create a test webpage and use it as a template..I don''t understand how that works though.

解决方案

This sounds like class homework. There is only so much we can do for coursework.

Stop. Think about the steps that your program will have to go through, then make sure you know how to do each little piece on its own. Once you can do the descrete little functions *then* worry about threading them together.

Can you read a text file?
Can you break down the contents at the commas?
Can you send your code to different functions based on the dismantled text file?
Can you programmatically add a control to a webpage file?
Can you determine the size and location of that control?


Thank you so much for the reply and I have indeed been doing my research and have found how to read a text file one word at a time. I was wondering after reading each word, can I have like a series of ''if'' conditions that would determine the type of control to add to the webpage. For example " if (word=="text"){ *add control to display textbox*}. I was thinking along those lines. Is that a feasible idea or wouldn''t that work?


A series of "if" statements would work. So would a "switch" construct.


这篇关于动态WebForm!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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