Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: Datagrid & Hyperlinkcolumn problem


Message #1 by "Bhanu" <bhanup@m...> on Wed, 5 Jun 2002 15:07:53
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 = "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 = New HyperLinkColumn()
        myhlc = DataGrid1.Columns(6)
        If e.Item.Cells(5).Text = "1" Then
            myhlc.DataNavigateUrlFormatString = "edit.aspx?id={0}"
            e.Item.BackColor = Color.Bisque
        ElseIf e.Item.Cells(5).Text = "4" Then
            myhlc.DataNavigateUrlFormatString = "updt3.aspx?id={0}"
            e.Item.BackColor = Color.Azure
        End If
    End Sub

Thank you
Bhanu

  Return to Index