Birdman
Birdman

Reputation: 5434

Retrieving form values in Master/Content pages

Form + element:

<form id="form" action="default.aspx" method="post" runat="server">
<input type="submit" id="submit" value="Submit" runat="server"/>
</form>

I am not able to retrieve form values by using the following code in Masterpages or Contentpages:

<% Response.Write(Request["submit"]); %>

The code-example above only works in independent .aspx pages.


Is it possible to retrieve form values in Masterpages or Contentpages in ASP.NET Webforms?

(I know about the built-in Webforms controls, but that is not the question/problem)

Upvotes: 0

Views: 234

Answers (1)

SGB
SGB

Reputation: 636

Try using Request[submit.UniqueID] this will avoid the hardcoded string and also will get the combined id of the control when rendered using master pages. Hope this helps

Upvotes: 1

Related Questions