Go Back   SitePoint Forums > Forum Index > Program Your Site > .NET
Newsletter FAQ Members List Calendar Mark Forums Read

New to SitePoint Forums? Register here for free!

SitePoint Sponsor
 
Reply
 
Thread Tools Display Modes
Old Nov 6, 2009, 07:47   #1
addstravel
SitePoint Addict
 
Join Date: Jun 2001
Location: London
Posts: 395
Unhappy Storing querystring variables in hidden form elements in masterpage

I would like to store some querystring variables in hidden form elements on the masterpage and reference them from web user controls so that I can preserve the information and consolidate the code in one place...

However, I cannot seem to get access to the information from the web user controls....

I am using public variables on the masterpage to set and get the hidden form element data, e.g:

Public Property SelectedId() As Integer
Get
If hdSelectedId.Value = String.Empty Then
hdSelectedId.Value = "0"
End If
Return hdSelectedId.Value
End Get
Set(ByVal Value As Integer)
hdSelectedId.Value = Value
End Set
End Property

But I cannot retrieve this information from the web user control using the following:

me.master.SelectedId

Even this will not work:

Response.Write(Obj.FindControl("hdSelectedId").ToString)

Any ideas how I can do this?
addstravel is offline   Reply With Quote
Old Nov 6, 2009, 09:13   #2
NightStalker-DNS
SitePoint Wizard
 
NightStalker-DNS's Avatar
 
Join Date: Jul 2004
Location: Cape Town, South Africa
Posts: 1,587
On your control or page you will have to try and access it. ((HiddenField)Page.Master.FindControl("hdnControlID")).Value.

I am not 100% sure on code now as its not infront of me and have not done it in a while Hope this helps
NightStalker-DNS is offline   Reply With Quote
Old Nov 8, 2009, 08:52   #3
addstravel
SitePoint Addict
 
Join Date: Jun 2001
Location: London
Posts: 395
Thanks nightstalker for your reply - I have decided to just grab querystring each time...
addstravel is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread | Next Thread »

Thread Tools
Display Modes

 
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Sponsored Links
 
Forum Jump


All times are GMT -7. The time now is 00:39.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Copyright 1998-2009, SitePoint Pty Ltd. All Rights Reserved