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

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

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

4条回答
  •  花落未央
    2021-01-26 14:47

    this method GetCurrentDate running server side but this formObj.elements.item('someLabel').value running on client

    try this..

    public  string GetCurrentDate()
    {
        return DateTime.Now.ToString("MM/dd/yyyy");
    }

for read value of input named as StartDate from server..

string postValue =  Request.Form["StartDate"]

提交回复
热议问题
Start Date: