ASP.Net 2.0 request.form not working with master page

I have a form containing a text box where users can type in a keyword and search a database.  Everything is working fine until I incorporate it into a content page with a master page.  Once I do that, Request.Form("Keyword") does not seem to be working.  I'm using ASP.Net 2.0, Visual Web Developer, and VB.  Is there something I should/could be using other than request.form to capture the value in the keyword field?  Thanks for the help.
____________________________________________
My content page contains the following:

<%@ page language="VB" masterpagefile="~/Site.master" codeFile="Default.aspx.vb" Inherits="_Default"%>

<asp:Content ID="Content2" ContentPlaceHolderID="mainContent" Runat="server">
____________________________________________
My master page contains:

<asp:ContentPlaceHolder ID="mainContent" runat="server" />

drees727Asked:
Who is Participating?
 
brwwigginsIT ManagerCommented:
0
 
raterusCommented:
Using Request.Form isn't really a good ASP.net approach.  I don't see this textbox you are using on your master page, but assuming it is there, you could try this.

masterValue = Page.Master.myTextBox.Text
0
 
drees727Author Commented:
The text box is on the content page and not the master page.  That seems to be the root of the problem.  I'm using the following on the content page:

<asp:TextBox ID="Keyword" runat="server"></asp:TextBox>

0
 
raterusCommented:
Why are you using Request.Form anyway?  That's not how we access textbox or any other posted values in asp.net.  You should be using the control reference that asp.net gives you to use to get at the value.  I'd have to guess if you look at the HTML source, you'll see that your textbox has a funky ID now, which you should never try to "guess" in code.
0
 
drees727Author Commented:
Both experts provided solutions that helped resolve the problem.  I'm going to split points but for some reason the Split Points page is not working (won't let me select more than one answer).  I'll contact EE to see if I can get it resolved.  Thanks for the help.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.