|
I am coding in ASP.NET 2.0 and trying to figure out how to gather info users can type onto the page and have that pass the data over to the 2nd page, and then finally gather all those fields and dynamically create a profile page that will be saved as a member00001.htm, member00002.htm for the 2nd user, and so on.
Can anyone help?
|
|
|
|
|
There are so many examples of how to create form fields and transfer data from page to page I find it difficult to believe even a beginner couldn't figure this out.
At least try something, then ask for help.
only two letters away from being an asset
|
|
|
|
|
since there are so many examples you are aware of, could you post some links? Is that too much to ask?
|
|
|
|
|
|
|
hello everyone:
I need to parse a complex xml file into meaningful controls. Here is what the XML file looks like:
<Controls>
<group>
<field name="CheckBox1" y="34.925" x="3.175" w="28" h="6">
<ui>
<checkButton>
<border>
<css style="single"/>
<fill/>
</border>
</checkButton>
</ui>
<font face="Arial"/>
<padding leftInset="1" rightInset="1"/>
<textAlign vAlign="middle"/>
<value>
<integer>0</integer>
</value>
<label placement="right" reserve="21">
<textAlign vAlign="middle"/>
<font face="Arial"/>
<value>
<text>Select Check Box</text>
</value>
</label>
</field>
<field name="textBox" y="3.175" x="3.17" w="62" h="9">
<ui>
<textBox>
<border>
<css style="">
</css>
</border>
<margin/>
</textBox>
</ui>
<font face="Arial"/>
<margin topInset="1" bottomInset="1" leftInset="1" rightInset="1"/>
<textAlign vAlign="middle"/>
<label reserve="25">
<font face="Arial"/>
<textAlign vAlign="middle"/>
<value>
<text>textbox label</text>
</value>
</label>
</field>
</group>
</Controls>
Can you help me figure out how to read this xml and come up with:
TextBox txtBox = new TextBox();
txtBox.name = "txtBox";
txtBox.Location = new Point(3,3)
txtBox.Size = new Size(9, 6);
...
and so on .. hopefully you get the idea of what I am trying to do.
I would really appreciate your help. Thanks.
|
|
|
|
|
With an XmlDocument
or do you want to use XSLT to transform it into a CS file?
|
|
|
|
|
Well not sure what approach will be the best.... so looking for advice from you guys.
Also how can I use XmlDocument to accomplish what I want? I havent worked much with xml to begin with a code example will help. Thanks.
|
|
|
|
|
For part of my reporting system I do something similar, but much simpler:
<Report>
<Parameters>
<Period DataType="System.String" Align="Left" Null="false" />
<StartTime DataType="System.DateTime" Align="Left" Null="false" Format="yyyy-MM-dd HH:mm" />
<EndTime DataType="System.DateTime" Align="Left" Null="false" Format="yyyy-MM-dd HH:mm" />
</Parameters>
...
from this I can populate a simple WinForms dialog with appropriate controls so the user can enter values for running the report, but I don't control font or position.
Reading XML with an XmlDocument is very easy -- I'll leave the research to you.
Once the document is read you can enumerate the group and field elements -- I'll leave the research to you.
With each field, you want to translate the ui element's child's name to determine which type of control to instantiate. From there, you can set the properties and add the control to the form.
Where does the XML come from? Do you have control over the schema of the XML? I think I'd make it simpler if I could.
|
|
|
|
|
XML is coming from a Legacy system which is pushing out xml for dynamic form generation.
I understand the "read the xml and iterate through the nodes concept", however, I was wondering if there is a better/simpler way, then just looping through the nodes, like maybe using Xpath or what have you. But thanks for the help I appreciate it.
|
|
|
|
|
hi
is that anyWay that convert html docs (include images,styles,...) to a single xml file ?
thanks.
|
|
|
|
|
hdv212,
Why would you want to do this?, HTML is already in a tag based language...
Regards,
Gareth.
|
|
|
|
|
hi Gareth
i want to save html files to database completely (include images,styles,...) and i can search in text
and display result corresponding to search keyword.
|
|
|
|
|
hdv212,
Didn't you already ask this question a few days ago?, Or was that someone else?
To do this would be more hassle than its worth. It would be much easier to save the HTML file to a server dir and store the location in the db and then search that file.
Regards,
Gareth.
|
|
|
|
|
There are parsers that attempt to turn HTML into XHTML. Of course, they won't 'include' any images, just tags that refer to them. It's theoretically possible to stuff images into a CDATA section, but the resultant file would no longer be HTML.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
if there is not anyWay to convert html files (include images,styles,...) to a single xml file, is that anyWay that convert html to .doc format and save in sqlServer dataBase ?
and can i search text in it ?
thanks
|
|
|
|
|
Try saving the document to an MHT format - that's the same way you do it with File / Save As in IE. This[^] article might be a starting point for you.
|
|
|
|
|
Once you save in a format other than plain text, no, you can't search it.
Christian Graus - Microsoft MVP - C++
"also I don't think "TranslateOneToTwoBillion OneHundredAndFortySevenMillion FourHundredAndEightyThreeThousand SixHundredAndFortySeven()" is a very good choice for a function name" - SpacixOne ( offering help to someone who really needed it ) ( spaces added for the benefit of people running at < 1280x1024 )
|
|
|
|
|
This isn't quite true. You can use Index Server to search content in other formats, even inside SQL Server using SQL Server commands like Freetext and Contains .
|
|
|
|
|
Hi guys. I am wanting to work with text files. Basically I want to read data from a fixed width text file selecting only certain fields. I have been searching everywhere but can't find any documentation on this. Can somebody please tell me where i can read up on this? I want to only select certain fields from the file and write that to say a multinline text box.
Any help would be greatly appreciated. I can read a full file into a text box but want to only select specific fileds.
|
|
|
|
|
I assume that the fields are placed at fixed locations. If so, you can use the Substring command on a string to get the fields at the relevant locations. You can read through the file using a StreamReader with the ReadToEnd method.
|
|
|
|
|
Read the file in 1-unit width at a time, and use the string.Substring method as indicated in the previous post. Do not, however, use StreamReader.ReadToEnd, unless you are absolutely certain that the input file size will be small enough so the entire file can be loaded into memory as a string.
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
Google for the FileHelpers library. There is also an article on it here on CP. It allows you to link class properties to specific text file fields.
|
|
|
|
|
I need this as an example for my new server and I really don't know how to do this in VB ... if you can help me someone
c# is here:
http://www.another-search.com/search-api/c-sharp-dot-net
|
|
|
|
|
Strip out the comments and summaries and your left with just a few lines
namespace XML_Dataset
{
public partial class Form1 : Form
{
private searchTable testSearchTable = new searchTable();
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.dataGridView1.DataSource = this.testSearchTable.Tables["search"];
}
private void getDataFromAS_Click(object sender, EventArgs e)
{
this.testSearchTable.Clear();
this.testSearchTable.ReadXml(this.testXMLStringAddr.Text);
}
private void generateDatasetToFile_Click(object sender, EventArgs e)
{
System.IO.StreamWriter xmlSW = new System.IO.StreamWriter("testSearchTable.xml");
this.testSearchTable.WriteXml(xmlSW, XmlWriteMode.WriteSchema);
xmlSW.Close();
MessageBox.Show("XML Schema was generatoted to the file: testSearchTable.xml");
}
}
}
Have a look at MSDN for each statement and you'll find examples for both C# and VB, if not - GOOGLE!
You'll need to have the code or dll for the searchTable class that's referenced near the top.
Dave
|
|
|
|