How do I pass an HTML element's value to a C# code-behind method?

后端 未结 4 1153
暗喜
暗喜 2021-01-26 14:27

For example, right now I have my ASPX like so:

4条回答
  •  不要未来只要你来
    2021-01-26 14:46

    You can make it a server control by adding runat="server" and it will be available in your code behind file. OR if you don't prefer this then use Request.Form["Name"] in your code behind file. Here "Name" is the name you are giving to your textbox control.

    In your case the name is StartDate

    So try to access the value of textbox from the code behind using Request.Form["StartDate"]

    Read this article.. https://www.aspsnippets.com/Articles/Get-value-of-HTML-Input-TextBox-in-ASPNet-code-behind-using-C-and-VBNet.aspx

提交回复
热议问题