Set attribute with JS and grab it by controlID in code-behind
After postback, attributes are cleared.
So how can I send an attribute applied to controlID via JS to the ne开发者_运维知识库xt request page?
Thanks in advance!
Javascript and ASP.Net controls can have a rather strained relationship. The main thing to remember is that ASP.Net needs to be able to get a value/see a change. Custom attributes may not be kept during a post back.
Have you tried storing the info using a hidden control?
<asp:HiddenField ID="id" Value="value" />
MSDN ref
精彩评论