[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-04-19
5
Medium Priority
?
1,257 Views
Last Modified: 2010-05-18
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" />

0
Comment
Question by:drees727
  • 2
  • 2
5 Comments
 
LVL 20

Accepted Solution

by:
brwwiggins earned 252 total points
ID: 16490492
0
 
LVL 33

Expert Comment

by:raterus
ID: 16490991
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
 

Author Comment

by:drees727
ID: 16491122
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
 
LVL 33

Assisted Solution

by:raterus
raterus earned 252 total points
ID: 16491183
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
 

Author Comment

by:drees727
ID: 16491794
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

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I recently went through the process of creating a Calendar Control of events with the basis of using a database to keep track of the dates that are selectable, one requirement was to have the selected date pop-up in a simple lightbox.  At first this…
ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses
Course of the Month19 days, 18 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question