Hyperlink column

  • Thread starter Thread starter Wernfried Schwenkner
  • Start date 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?
 
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
 
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?
 
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")
 
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
 
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?
 
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?
 
Back
Top