944,175 Members | Top Members by Rank

Ad:
  • ASP.NET Discussion Thread
  • Unsolved
  • Views: 22898
  • ASP.NET RSS
Feb 25th, 2005
0

How to transfer values between ASP.NET pages

Expand Post »
Hi everyone, here's my problem.

I have 3 web forms. WebForm1 contains a tab control "UltraWebTab1" with just 2 tabs.
First tab displays Target URL WebForm2.
Second tab displays Target URL WebForm3.

WebForm2 contains a label lblSourceLabel with a text value of '123'.
WebForm3 contains a label lblTargetLabel with a null value.

My goal is to transfer the lblSourceLabel value to lblTargetLabel upon tab change from tab1 to tab2. I'm using JavaScript, ASP.NET and Infragistics.

Here's my code, but it's not working. What am I doing wrong?

function sendValue()
{
// Get reference to UltraWebTab
var ultraTab = igtab_getTabById("UltraWebTab1");
if (ultraTab == null)
return;
//
// Get reference to 1st tab (WebForm2 )
var tab = ultraTab.Tabs[0];
// Get reference to 2nd tab (WebForm3)
var tab1 = ultraTab.Tabs[1];
//
var source = tab.findControl("lblSourceLabel ");
var target = tab1.findControl("lblTargetLabel");
target.value = source.value;
}
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
omnis is offline Offline
3 posts
since Feb 2005
Mar 10th, 2005
0

Re: How to transfer values between ASP.NET pages

You can do it with the Session and Application objects...but it's better if you use Cookies or GET/POST methods.
Reputation Points: 46
Solved Threads: 2
Junior Poster
Iron_Cross is offline Offline
117 posts
since Jul 2003
Mar 11th, 2005
0

Re: How to transfer values between ASP.NET pages

Since I am not at home, but at work which has limited resources, I hope this helps till I get chance to look at this problem more closely.

Here is a some links to passing values around with Javascript that may help!

LINK 1

LINK 2



Quote originally posted by omnis ...
Hi everyone, here's my problem.

I have 3 web forms. WebForm1 contains a tab control "UltraWebTab1" with just 2 tabs.
First tab displays Target URL WebForm2.
Second tab displays Target URL WebForm3.

WebForm2 contains a label lblSourceLabel with a text value of '123'.
WebForm3 contains a label lblTargetLabel with a null value.

My goal is to transfer the lblSourceLabel value to lblTargetLabel upon tab change from tab1 to tab2. I'm using JavaScript, ASP.NET and Infragistics.

Here's my code, but it's not working. What am I doing wrong?

function sendValue()
{
// Get reference to UltraWebTab
var ultraTab = igtab_getTabById("UltraWebTab1");
if (ultraTab == null)
return;
//
// Get reference to 1st tab (WebForm2 )
var tab = ultraTab.Tabs[0];
// Get reference to 2nd tab (WebForm3)
var tab1 = ultraTab.Tabs[1];
//
var source = tab.findControl("lblSourceLabel ");
var target = tab1.findControl("lblTargetLabel");
target.value = source.value;
}
Team Colleague
Reputation Points: 211
Solved Threads: 27
Master Poster
Paladine is offline Offline
793 posts
since Feb 2003
Mar 25th, 2007
0

Re: How to transfer values between ASP.NET pages

Quick Question Iron_Cross,

why is Cookies better than Application objects? Just curious..
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
blacklocist is offline Offline
87 posts
since Apr 2006
Mar 26th, 2007
0

Re: How to transfer values between ASP.NET pages

in answer the original question your page references were incorrect. you have to get a reference to the calling page from the Server.Request object. Cast that to a Page object then findcontrol for your tabs. This is better than javascript as it is all done on the server. There are plenty of articles on how to get the calling page.
The alternative is to use session objects etc as mentioned above. The best way is to pass the information in as a query so when you redirect from one page to the other grab the labels value and pass it to the next page in the request eg www.yoursite.com/newpage?labelvalue='the value you just grabbed'
This will guarantee the value will get there (no relying on cookies being turned on etc) and easy to get at the other end
Reputation Points: 26
Solved Threads: 11
Posting Whiz in Training
f1 fan is offline Offline
275 posts
since Jan 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP.NET Forum Timeline: Passing An Connecting String
Next Thread in ASP.NET Forum Timeline: Get a Session state from a Query





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC