简体   繁体   中英

How to pass values from HTML tags/elements to Code Behind in C#?

What's the best way to pass values from a HTML tag/elements to code behind without using the runat="server". Example

<input id="tags" type="text" />

Now, I want to pass the value of tags to code behind.

string tagsvalue = this.Request.Form.Get( "tags" );

I'm trying to use the code above but is not working. Any help will be really appreciate it.

您可以使用name属性在名称/值对中指定名称,而不是id

<input name="tags" id="tags" type="text" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM