Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: AW: Datagrid & Hyperlinkcolumn problem


Message #1 by "ProDevTeam" <ProDevTeam@g...> on Fri, 7 Jun 2002 09:09:48 +0200
Have you tried it with

 e.Item.Cells(5).Text =3D "0"

I mean the datagrid is zero based, but I=B4m not sure

regards
	Bj=F6rn

-----Urspr=FCngliche Nachricht-----
Von: Bhanu [mailto:bhanup@m...]
Gesendet: Mittwoch, 5. Juni 2002 17:08
An: ASPX_Professional
Betreff: [aspx_professional] Datagrid & Hyperlinkcolumn problem


Hi,

I am trying to dynamically assign DataNavigateUrlFormatString value to
the
hyperlinkcolumn that I have created during design time. This problem is
that the url that has assigned to cell(5) in row(1) get assigned to cell
(5) in row(2). In the sense, the first row where

                     e.Item.Cells(5).Text =3D "1"

the url get assigned but it gets assigned to the second row element.
This
is the code, please help me


    Private Sub DataGrid1_ItemDataBound(ByVal sender As Object, ByVal e
As
System.Web.UI.WebControls.DataGridItemEventArgs) Handles
DataGrid1.ItemDataBound
        myhlc =3D New HyperLinkColumn()
        myhlc =3D DataGrid1.Columns(6)
        If e.Item.Cells(5).Text =3D "1" Then
            myhlc.DataNavigateUrlFormatString =3D "edit.aspx?id=3D{0}"
            e.Item.BackColor =3D Color.Bisque
        ElseIf e.Item.Cells(5).Text =3D "4" Then
            myhlc.DataNavigateUrlFormatString =3D "updt3.aspx?id=3D{0}"
            e.Item.BackColor =3D Color.Azure
        End If
    End Sub

Thank you
Bhanu




  Return to Index