Need some help with HyperLinkColumn!

M

Morten

Hi.

After a while I finaly discovered how to use HyperLinkColumns.
What I can't find is how to send mote than one "value" like
page.aspx?id1&id2!!!

<asp:HyperLinkColumn DataNavigateUrlField="InvoNo"
DataNavigateUrlFormatString="Invo.aspx?Id={0}" DataTextField="InvoNo"
HeaderText="Invo No.">
<HeaderStyle HorizontalAlign="Left"></HeaderStyle>
<ItemStyle HorizontalAlign="Left"></ItemStyle>
</asp:HyperLinkColumn>

I also need to send: ID2=Request.QueryString("custno")
??
Invo.aspx?Id={0}&ID2=Request.QueryString("custno")


Thanks...

Morten
 
A

AW

Hi Morten,

Unfortunately, you can't use more than one column as a data source for an
HyperLinkColumn.

However, if the object that you're binding to your DataGrid is a DataTable,
there's a trick: you can add a new computed column to the DataTable, and
bind this column to your HyperLinkColumn.

In your ASPX, write:
<asp:HyperLinkColumn DataNavigateUrlField="InvoNo"
DataNavigateUrlFormatString="Invo.aspx?{0}" DataTextField="Computed"
HeaderText="Invo No.">

and in your CodeBehind, use:
DataSet ds = new DataSet();

sqlDataAdapter2.Fill(ds);

DataTable t = ds.Tables[0];

DataColumn dc = new DataColumn("Computed");

dc.Expression="Id=' + InvoNo + '&id2="+ Request.QueryString("custno") + "'";

t.Columns.Add(dc);

DataGrid1.DataSource=ds;

DataGrid1.DataBind();
 
M

Morten

Thanks AW.

Could You please help me a bit more.

My datagrid are filled like this.

Dim aOpenPost As New OleDb.OleDbDataAdapter("SELECT InvoNo, Dt,
Am, CustNo FROM CustTr WHERE (CustNo = '" & AcNo & "' " & tmpDt & ")", cnn)
Dim dsOpenPost As DataSet = New DataSet()
aOpenPost.Fill(dsOpenPost, "CustTr")
grdOpenPost.DataSource = dsOpenPost
grdOpenPost.DataBind()


:) Morten
 
M

Morten

After a tortal 'Read-down' og my pages and code I have reconsidered and done
some redisign and found that Request.QueryString("custno") belongs in a
session variable.

No more agony.

Thank.
 

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

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top