在ASP.NET中,我可以允许以数字开头的字符串作为ID吗?

In ASP.NET, can I allow a string starting with a number to be an ID?

我是 ASP.NET(为 Sitefinity 构建)的新手,正在为客户处理 Salesforce 表单。他们的一些输入如下所示:

<input  id="00N1600000Ernn3" maxlength="50" name="00N1600000Ernn3" size="20" type="text" />

所以我在 asp 中创建了一个这样的输入:

<asp:TextBox ID="00N1600000Ernn3" MaxLength="50" runat="server" ClientIDMode="Static" />

当我编译时,我看到这个错误来自设计器文件:

invalid token '00' in class, struct, or interface member declaration 

如果我将 id 切换为以字符开头,问题就解决了。我的问题是 Salesforce 在提交更新数据库和分析时使用该名称。

Control ID用于在'designer'文件中生成一个属性。因此,ID必须符合标识符的命名规则。这些规则指定标识符必须以字母开头:

https://msdn.microsoft.com/en-us/library/aa664670(VS.71).aspx

Sitefinity 确实有一个 Salesforce Connector tool but the use of that module is tied to what license your client is using. One approach I've taken is instead of trying to match the ids of the Salesforce form, you can just paste the form html in a user control and then register 用户可以使用 Thunder 在 Sitefinity 中将其作为小部件进行控制。

您可能必须添加一个按钮控件来指定表单的回发 url:

<asp:Button runat="server" ID="btnSubmit"  PostBackUrl="https://www.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" Text="Submit" />