Hyperlink column

  • Thread starter Wernfried Schwenkner
  • Start date
W

Wernfried Schwenkner

I have a datagrid with a hyperlink column. So I can specify only one
NavigationUrl to all rows. How can I get an Id to the target Url, beeing
able to display different data records an a more detailed page?
 
J

John Timney \(ASP.NET MVP\)

Look at the DataBinder.Eval method to manipulate the data held in your
dataset as its bound.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
W

Wernfried Schwenkner

Look at the DataBinder.Eval method to manipulate the data held in your
dataset as its bound.

Thanks, I could manage this.

But now it seems to be better to pass the Id from the grid page to the
detail page by a session variable. How can this be done?
 
R

Riki

Wernfried said:
I have a datagrid with a hyperlink column. So I can specify only one
NavigationUrl to all rows. How can I get an Id to the target Url,
beeing able to display different data records an a more detailed page?

Use the HyperlinkColumn's DataNavigateUrlFormatString property.

For instance:
DataNavigateUrlFormatString="targetpage.aspx?ID={0}"
DataNavigateUrlField="ID"

The ID will be inserted at the place of the {0} mark.

In the detail page, retrieve your ID with:
Request.QueryString("ID")
 
J

John Timney \(ASP.NET MVP\)

Try this

In page1.aspx code:
Session["MyDataSet" + Session.SessionId] = dsObject;

In page2.aspx code:
Dataset dsObject = Session["MyDataSet" + Session.SessionId];
if (null != dsObject)
{
// Do something with the dataset.
}

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director
 
W

Wernfried Schwenkner

Try this

In page1.aspx code:
Session["MyDataSet" + Session.SessionId] = dsObject;

In page2.aspx code:
Dataset dsObject = Session["MyDataSet" + Session.SessionId];
if (null != dsObject)
{
// Do something with the dataset.
}

Sorry, if I didn't explain it very well. I know how to pass a variable
from page to page with the Session-property.

My problem is, in the datagrid of page 1 I have a link button which
navigates to page 2. When clicking this, the Id shall be inserted into
the session property. How can this be done?
 
J

John Timney \(ASP.NET MVP\)

as Riki explains, add it to the URL DataNavigateUrlField as the data binds
and retrieve it on page load at the recipient page following a click - stick
it in the session then. You could also use the eval method to load it into
session as the first page loads so its already there before your click
occurs.

--
Regards

John Timney
ASP.NET MVP
Microsoft Regional Director

Wernfried Schwenkner said:
Try this

In page1.aspx code:
Session["MyDataSet" + Session.SessionId] = dsObject;

In page2.aspx code:
Dataset dsObject = Session["MyDataSet" + Session.SessionId];
if (null != dsObject)
{
// Do something with the dataset.
}

Sorry, if I didn't explain it very well. I know how to pass a variable
from page to page with the Session-property.

My problem is, in the datagrid of page 1 I have a link button which
navigates to page 2. When clicking this, the Id shall be inserted into
the session property. How can this be done?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,140
Latest member
SweetcalmCBDreview
Top