How do I get value of a textbox that’s placed in the masterpage?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I agree with Pete.
Sometimes it is convenient to put general items into the master page. In contrast to classic asp.net it is harder to get the value with every post. In classic asp.net there is only one formular on the html page wich will be posted and all works well. In mvc there could be more formulars on the page. You have to put the textbox into a every form to get the value in every post – no solution.
A custom user control (ascx) might be a solution. Put the textbox in and place the custom control into the form where you need the value. If you have more forms or a complicated layout, than it is no solution.
A hidden field might be a solution. Replicate value changes of your original textbox into hidden fields placed in the formulars where you need the value.