Link to home
Start Free TrialLog in
Avatar of EndeavorToPersevere
EndeavorToPersevereFlag for United States of America

asked on

Need to convert an html form into an asp.net control

This seems like it shouldn't be that hard but I'm not sure how to do this.

An outside contractor has handed me an html form for our site.

Our site is in sitefinity and I would like to convert this thing to an asp.net control.

However just slapping the html into the ascx file makes the cms editor lock up.

I know I can translate the inputs to textboxes, the options to a drop-down list etc. but how do I get the data sent when the original form had something like this:

<form action="https://theirsite/servlet/servlet.WebToCase?encoding=UTF-8\" method="POST">
inputs
options
hidden fields

<input type="submit" name="submit" />
</form>
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

You can change your form tag to <form ID="form1" runat="server"> and add runat="server" to all inputs. They will behave just like asp:textboxes, etc.
Avatar of EndeavorToPersevere

ASKER

So how does the data get passed to http://theirsite/servlet/servlet.WebToCase?encoding=UTF-8 when the button gets clicked?

Do I need to put code in the btnSubmit_Click event?
We currently have this page http://www.metalogix.com/events.aspx that uses hard-coded html. I am trying to have it automatically build from the events but I am running into trouble resolving the URL for the Registration URL.

Line 706 in the attached control code is where I am trying to translate this - can you please tell me the correct call to get a properly resolved URL - I am expecting something like "https://metalogix.webex.com/metalogix/lsr.php?AT=pb&SP=EC&rID=4989677&rKey=0663671568042aaf" after it is resolved.

Thanks!
I'm not familiar with sitefinity specifically, but putting runat="server" in your form tag will cause the data in the inputs for that page to be posted to itself on the server side where you can retrieve the values for any inputs with the runat="server" attribute. From there you can do whatever you need including calling a Web Service to parse the data entered and return a value.

Did you intend to attach some code? Line 706??
Sorry tommyBoy - the thing about line 706 was going in a trouble ticket for Sitefinity. Copy/paste error.

I appreciate your thoughts. Unfortunately the contractor is not providing a web service interface.

So what I'm left trying to sort out is some way to pass the data from aspx so it looks like it came from the html form.

I guess I 'm stuck making an html page with Javascript validation outside the CMS.
SOLUTION
Avatar of Tom Beck
Tom Beck
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Maybe I'm missing something obvious, here's the setup.

Our site runs on Sitefinity which is an ASP.Net / Telerik / C# based system (it does do VB.Net too but C# is preferred).

To create a page I have
- a .master file which contains the header, body, a form statement and various divs and content place holders to create the layout. The master I am trying to use is based on html 5.
- a theme with a style sheet and images to create the page look

I upload the .master file to Sitefinity and tie it to the theme as a template.

From there when I create a page I select the template which gives me the skeleton of the page.

I then fill the page with "generic content" html or controls/widgets (.ascx) that are built-in or I write.

Normally when we talk to the system this vendor has added on to, I talk through a web service. In this case, they want to hand me an html form to use.

What I want to do is have this page be in the CMS like any other page so the text on it can be edited/styled like the rest of the pages. I want to do validation preferably in C# and not Javascript and possibly add the captcha we are using on the other pages and then send the data off to them.

When I tried just slapping the html in an ascx file it locked up the page editor in the CMS. I'm reading that you can't have nested forms.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks to tommyBoy for giving me the hints to get started on this.