You can't do it using a normal bound column.
You need a template column.
Then in the dg_ItemDataBoun d event you create an instance of the hyperlink
and find it using FindControl and then set its properties.
In this case the dg is bound to a collection and the index of the collection
equals the index of the grid. So you can always identify whcih row you are
on.
=============== =============== =============== =============== ===========
<asp:TemplateCo lumn SortExpression= "myColumn" HeaderText="My Header">
<ItemTemplate >
<asp:Hyperlin k id="hylMyColumn "
runat="server"> </asp:Hyperlink>& nbsp;
</ItemTemplate>
</asp:TemplateCol umn>
=============== =============== =============== =============== ===========
Private Sub dg_ItemDataBoun d(ByVal sender As Object, ByVal e As
DataGridItemEve ntArgs) Handles dg.ItemDataBoun d
If e.Item.ItemType = ListItemType.It em OrElse e.Item.ItemType =
ListItemType.Al ternatingItem Then
'need to take paging into account!
Dim mIndex As Integer = CType(sender, DataGrid).PageS ize *
CType(sender, DataGrid).Curre ntPageIndex + e.Item.ItemInde x
'set hyperlinks values:
'Note: in the HTML the is required because the grid cells will
change shape w/o it when there is no data.
Dim ohylMyColumn As HyperLink =
CType(e.Item.Fi ndControl("hylM yColumn"), HyperLink)
ohylMyColumn.Na vigateUrl =
"javascript
:Lef tSideWin('ViewS omePage.aspx?Ke y=" & mCollection(mIn dex).key &
_
"&KeyType=" & mCollection(mIn dex).keytype & "','MyScreen'); "
oHylInvNumber.T ext = mCollection(mIn dex).MyDescript ion
End If
End Sub
=============== =============== =============== =============== ===========
--
Joe Fallon
"carlor" <ca****@discuss ions.microsoft. com> wrote in message
news:61******** *************** ***********@mic rosoft.com...
Hi there,
I have a datagrid that is bound to a datasource. The grid has a hyperlink
column and I want to generate the URL using the URL Field and URL Format
String fields in the Property Builder.
The problem I'm running into is trying to generate the URL with more than
one URL Field entry. I need to have more than field but I can't figure out
how to add more than one field in the URL Field textbox. Is it possible?
I would want the URL Format String to look something like...
MyURL.aspx?fiel d_1={0}&field_2 ={1}
Any help would be greatly appreciated.
Carlo.