473,379 Members | 1,533 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,379 software developers and data experts.

changing hyperlinks within item templates at runtime

There are a number of places in my app where I want the user to work
with an item (a real physical item referred to by its stock number) If
such an item hasn't been selected, I redirect the user to a page to
select one. Then having selected one, want to redirect them back from
where they came (passing the stockitemID ). It's this latter part
(redirection from where they came) that's bugging me.

I'm using a datagrid to display the items that fit the search criteria.
One of the columns is a hyperlink that needs to redirect the user back
to the page that they came from.

At 1st when I had only one page, I hard coded the return page like this:

<item template>
<a href='returnpage.aspx?itemid=<#%databinder.eval(co ntainer.dataitem,
"ID")%>.... and the rest..... </a>
</item template>

I need to change "returnpage.aspx" to reflect the page that the user
came from. It's not getting the value that's the problem, it's getting
that value into the above statement!

Subsequently, I made the item template contain <an asp:hyperlink> in the
hope that I could manipulate the navigateURL property in the code
behind. However, I get an "Object reference not set to an instance of
an object" error when I try that. (It seems that "ids" of items within
datagrids aren't what they seem!)

I thought of passing the returnURL to the SQL server stored proc and
passing it back again. That would definitely work (I could refer to the
return page using the

<%# databinder.eval.....%>

syntax, but it seems very silly to pass a parameter only to return it
back again!
There must be another way! Any advice gratefully received.

--
Paul
Nov 18 '05 #1
2 2052
Paul, there are a couple ways to go, but here's one: return the string for your "return page" from a public function of the page class, then use something like..

href='<%# MyReturnPage() + databinder.eval(etc.) %>

hth

Bil

----- Paul wrote: ----

There are a number of places in my app where I want the user to work
with an item (a real physical item referred to by its stock number) If
such an item hasn't been selected, I redirect the user to a page to
select one. Then having selected one, want to redirect them back from
where they came (passing the stockitemID ). It's this latter part
(redirection from where they came) that's bugging me

I'm using a datagrid to display the items that fit the search criteria.
One of the columns is a hyperlink that needs to redirect the user back
to the page that they came from

At 1st when I had only one page, I hard coded the return page like this

<item template><a href='returnpage.aspx?itemid=<#%databinder.eval(co ntainer.dataitem,
"ID")%>.... and the rest..... </a></item template

I need to change "returnpage.aspx" to reflect the page that the user
came from. It's not getting the value that's the problem, it's getting
that value into the above statement

Subsequently, I made the item template contain <an asp:hyperlink> in the
hope that I could manipulate the navigateURL property in the code
behind. However, I get an "Object reference not set to an instance of
an object" error when I try that. (It seems that "ids" of items within
datagrids aren't what they seem!

I thought of passing the returnURL to the SQL server stored proc and
passing it back again. That would definitely work (I could refer to the
return page using th

<%# databinder.eval.....%

syntax, but it seems very silly to pass a parameter only to return it
back again
There must be another way! Any advice gratefully received

--
Pau

Nov 18 '05 #2
Paul, there are a couple ways to go, but here's one: return the string for your "return page" from a public function of the page class, then use something like..

href='<%# MyReturnPage() + databinder.eval(etc.) %>

hth

Bil

----- Paul wrote: ----

There are a number of places in my app where I want the user to work
with an item (a real physical item referred to by its stock number) If
such an item hasn't been selected, I redirect the user to a page to
select one. Then having selected one, want to redirect them back from
where they came (passing the stockitemID ). It's this latter part
(redirection from where they came) that's bugging me

I'm using a datagrid to display the items that fit the search criteria.
One of the columns is a hyperlink that needs to redirect the user back
to the page that they came from

At 1st when I had only one page, I hard coded the return page like this

<item template><a href='returnpage.aspx?itemid=<#%databinder.eval(co ntainer.dataitem,
"ID")%>.... and the rest..... </a></item template

I need to change "returnpage.aspx" to reflect the page that the user
came from. It's not getting the value that's the problem, it's getting
that value into the above statement

Subsequently, I made the item template contain <an asp:hyperlink> in the
hope that I could manipulate the navigateURL property in the code
behind. However, I get an "Object reference not set to an instance of
an object" error when I try that. (It seems that "ids" of items within
datagrids aren't what they seem!

I thought of passing the returnURL to the SQL server stored proc and
passing it back again. That would definitely work (I could refer to the
return page using th

<%# databinder.eval.....%

syntax, but it seems very silly to pass a parameter only to return it
back again
There must be another way! Any advice gratefully received

--
Pau

Nov 18 '05 #3

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

Similar topics

1
by: Paul | last post by:
There are a number of places in my app where I want the user to work with an item (a real physical item referred to by its stock number) If such an item hasn't been selected, I redirect the user...
1
by: Paul | last post by:
There are a number of places in my app where I want the user to work with an item (a real physical item referred to by its stock number) If such an item hasn't been selected, I redirect the user...
0
by: Paul | last post by:
There are a number of places in my app where I want the user to work with an item (a real physical item referred to by its stock number) If such an item hasn't been selected, I redirect the user...
4
by: =?Utf-8?B?REZC?= | last post by:
Within an XSLT transformation, I'm trying to switch the default namespace within a section of the generated XML document to a shared namespace. This way, the content of this section does not have...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

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.