function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
gringoesegringoese 

Using web-to-lead with asp.net

I am converting a website to asp.net and running into problems with my Web-To-Lead forms. I need to use use the .NET server controls in my form so my text box code would be something like:
<asp:TextBox ID="first_name" runat="server" />
instead of:
<input name="first_name" type="text" />

The problem with this is that .NET renames the input fields. The resulting HTML comes out like this:   

<input name="ctl00$content$first_name" type="text" id="ctl00_content_first_name" />

Salesforce won't accept this as it reuqires the field in this case must be named "first_name", not "ctl00$content$first_name".

Has anyone run into this and if so how did you get around it?

werewolfwerewolf
If you need to mix up the W2L post with .NET, you might think about eschewing W2L and submitting the data via the web services API instead.
gringoesegringoese
Thanks for your reply. I haven't used the web services API before. Do you know where there are any examples/tutorials of this?
werewolfwerewolf
http://wiki.apexdevnet.com/index.php/Web_Services_API#.Net_and_Visual_Basic
Steve SmithSteve Smith

Use an Html control and mark it runat="server" instead of the asp:textbox

<input id="first_name" type="text" runat="server" ></input>

S

gringoesegringoese
Because I'm pressed for time I just converted my forms to regular HTML like:
<input name="first_name" type="text" />
I didn't add runat="server" to the input tag because I couldn't think of anything to gain by using it.  

To handle each field, in my code behind file I just use:
Request.Form["first_name"]

For validation I just use my own Javascript and C# (for client side/server side). I am not doing anything else that elaborate with my forms where I'll really miss the server controls. I would like to use the API and in the future I will probably go back and switch to that method.
 
Steve SmithSteve Smith

By adding runat="server" you can access the control in code-behind as it is then running on the client side all properties are available as with any other server control

you should add an Id="first_name"

for example

firstname.Attributes.Add("onclick","doSomething");

public void doSomething(object sender, EventArgs e)

{

}

Regards S

 

Steve SmithSteve Smith
Sorry running on the Server Side not "client side"
RajeevKumarRajeevKumar
check this out :
http://mytechnicalcorner.blogspot.com/2008/04/sales-force-web-to-lead-form-custom.html