<asp:xml> question

  • Thread starter Thread starter Danny Ni
  • Start date Start date
D

Danny Ni

Hi,

I use the <asp:xml> control, xml and xslt to generate a HTML for users to
input data, here is my HTML snippet in a web form:
<asp:Xml id="Xml1" runat="server" TransformSource="entry.xsl"
DocumentSource="data.xml"></asp:Xml>

The form display correctly in the browser, the question is, how do I get the
values users input?

To clarify a little bit, with data.xml and entry.xsl, Xml1 generated HTML
form like this:
<table border="0">
<tr>
<td>
Address: <input type="text" id="txtAddress" name="txtAddress"
class="underline" onchange="update1();">
</td>
</tr>
<tr>
<td>
Name: <input type="text" id="txtName" name="txtName" class="noborder"
onchange="update1();">
</td>
</tr>
</table>
The users can input something into address and name fields. In the web form
code behind file, I would like to get values user inputted.

Thanks in Advance
 
Danny,
In order to get the values in your server code, the input fields need to
be server controls. Just transforming xml to emit html <input> elements
doesn't make them server controls, and your server code will have no
visibility to their values.

I don't know the details of your situation, but if the page posts back
to itself, these <input> elements will still send data to the server, so you
could get these values by using Request.Form["txtAddress"] and
Request.Form["txtName"].

Best regards,
Jeffrey Palermo
 
Back
Top