开发者

Can I have different name and id attributes on a form element?

I have a web form with usual elements (first name, last name, etc). The Postback URL is a different website altogether as the form is intented to post lead information to another website.

The site that accepts the lead is expecting First Name to come over as "FName", and Last Name to come over as "LName". Is there any way I can set the ID of a textbox to "txtFName", but submit it over the wire as "FName"? I tried changing the na开发者_运维问答me attribute, but at runtime it sets the name = id.


You should use normal (non-runat="server") <input> elements.
You will then have complete control over the name and id.


for 'standard-html-input-elements', the name attribute, is the one being submitted, the id-attribute may be used e.g. in javascript.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜