473,569 Members | 2,701 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Request.Form with Masterpage

Hello,

How do you use Request.Form["HiddenFiel d"] when the first page is using a
MasterPage?

Thanks, sck10
Nov 23 '06 #1
6 11584
Hello Steve,

Do you mean in the original page, the hidden fields are put on MasterPage's
content? If so, this does make the identification of the hidden
fields(form items) in target page abit difficult. Becaue for controls put
in Master page, its name and id will be mangled. For example, the following
html control in master page

=========
<input id="hidden1" name="hidden1" runat="server" type="hidden"
value="hidden1 value" />
<input id="hidden2" name="hidden2" runat="server" type="hidden"
value="hidden2 value" />
===========

will be rendered as below finally:

<input name="ctl00$hid den1" type="hidden" id="ctl00_hidde n1"
value="hidden1 value" />
<input name="ctl00$hid den2" type="hidden" id="ctl00_hidde n2"
value="hidden2 value" />

Thus, on the target page, you can not directly use the original
hiddenfield's name to quey the Request.Form collection. One flexible means
is to query the Request.Form collection and find the one that contains the
hiddenfield's unmangled name. e.g.

========in target page=========== ====

protected void Page_Load(objec t sender, EventArgs e)
{
foreach (string key in Request.Form.Ke ys)
{
if(key.Contains ("hidden1"))
Response.Write( "<br/>" + key + ": " + Request.Form[key]);
}
}
=============== ===============

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

=============== =============== =============== =====

Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.

=============== =============== =============== =====

This posting is provided "AS IS" with no warranties, and confers no rights.
Nov 23 '06 #2
Hi,

Steven Cheng[MSFT] wrote:
Becaue for controls put in Master page, its name and id will be mangled.
.... which you can work around by using the .ClientID-property.

Cheers,
Olaf
--
My .02: www.Resources.IntuiDev.com
Nov 23 '06 #3
Hi Olaf,

thanks for your input.

I think what you mentioned should be "Control.Unique ID" :)

http://msdn2.microsoft.com/en-us/lib....uniqueid(VS.8
0).aspx

BTW, the problem here is that he is cross post to a remote page on
different server, this "UniqueID" is not workable.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 23 '06 #4
Thanks Walter, I will try your suggestion.

"Steven Cheng[MSFT]" <st*****@online .microsoft.comw rote in message
news:gt******** ******@TK2MSFTN GXA01.phx.gbl.. .
Hello Steve,

Do you mean in the original page, the hidden fields are put on
MasterPage's
content? If so, this does make the identification of the hidden
fields(form items) in target page abit difficult. Becaue for controls put
in Master page, its name and id will be mangled. For example, the
following
html control in master page

=========
<input id="hidden1" name="hidden1" runat="server" type="hidden"
value="hidden1 value" />
<input id="hidden2" name="hidden2" runat="server" type="hidden"
value="hidden2 value" />
===========

will be rendered as below finally:

<input name="ctl00$hid den1" type="hidden" id="ctl00_hidde n1"
value="hidden1 value" />
<input name="ctl00$hid den2" type="hidden" id="ctl00_hidde n2"
value="hidden2 value" />

Thus, on the target page, you can not directly use the original
hiddenfield's name to quey the Request.Form collection. One flexible means
is to query the Request.Form collection and find the one that contains the
hiddenfield's unmangled name. e.g.

========in target page=========== ====

protected void Page_Load(objec t sender, EventArgs e)
{
foreach (string key in Request.Form.Ke ys)
{
if(key.Contains ("hidden1"))
Response.Write( "<br/>" + key + ": " + Request.Form[key]);
}
}
=============== ===============

Hope this helps.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
>

Nov 23 '06 #5
Thanks for your reply Steve,

Please feel free to let me know if you meet any further problem.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.

Nov 24 '06 #6
Hi,

Steven Cheng[MSFT] wrote:
I think what you mentioned should be "Control.Unique ID" :)
sorry for my posting, I wasn't reading carefully enough and assumed a
client-side thing (i.e. some JavaScript looking for the control). :-P

Cheers,
Olaf
--
My .02: www.Resources.IntuiDev.com
Nov 24 '06 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
10320
by: Christopher Brandsdal | last post by:
Hi! I get an error when I run my code Is there any other way to get te information from my form? Heres the error I get and the code beneath. Line 120 is market with ''''''''''''Line 120''''''''''''''''''''' ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
5
1622
by: Wayne Wengert | last post by:
I am trying to use Request.Form to differentiate between when a page containing a form is first loaded and when it is reloaded as a result of the user clicking on the Submit button. Things are not working as expected. Some snippets of my code are: fSubmit = Request.Form("Submit1") = "Process" Response.Write("Submit1 " &...
4
4279
by: Paxton | last post by:
At the risk of being told "If it ain't broke, don't fix it", my code works, but is ugly. Part of the admin site I'm working on at the moment includes a facility for users to enter Formulations (recipes for making cosmetics etc) in 3 stages: Stage 1: basic info such as title, method etc and number of Phases (steps in recipe). Stage 2:...
5
2190
by: Jack | last post by:
Hi, I am trying to get a thorough understanding of a code where a addition or deletion of records can be done from a list of records. For addition part of the form, data is being obtained from set of input boxes. The following is the code being used: If Len(Request.Form("ID_0"))>0 Then AuthorID=Request.Form("ID_0")...
2
1555
by: Joseph James | last post by:
Hi all, I am very new to ASP.net. As I was going through new features of asp.net, I came across Masterpage and I tried to use it. But when the form is posted to another page, the key names of the controls are pretended with the masterpage content place holder's name. Is there any way how can I get the value of a control from the request.form?...
8
3071
by: abcd | last post by:
I can get the value on the form at the server side by using Request.form("max") when max field is disabled I dont get value. For GUI and business logic purpose I have disabled some fields with the values, but when I update Request.form does not return me anything for disabled fields. How to read disabled fields at the server side
4
4842
by: whyyyy | last post by:
USING IIS 5.1, and Windows XP pro, the following form works on my system, and I can use as many form elements as I wish, as long as all form elements have the same name: "words", in this example. Help -- why can`t I give each form element a different name? Any suggestions will be gratefully appreciated. Also,See example at very bottom...
4
3745
by: Michael Kujawa | last post by:
I am using the following to create an SQL statement using the names and values from request.form. The loop goes through each item in request.form The issue comes in having an additional "and" at the end of the loop and the value of x3 as not all options may be selected from the form yet the loop goes through the entire request.form list ...
12
2131
by: Mark Rae | last post by:
Hi, See the previous thread Request.Form abuse in this newsgroup... I'm looking for a simple and efficient way to prevent people hijacking the <formtags on my websites and using them to send spam. I would imagine they're using the HttpWebRequest method for this. Essentially, it would require a property on a WebForm that indicates...
0
7697
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7924
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8120
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7672
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
1
5512
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5219
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3653
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
937
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.