F
Fabrice
Hello,
First, thanks to felix for his answer.
But :-( , I'm feeling newbie :! I' don't understand all the situation.
The trouble :
Always in the road whith my Datagrid and my ItemTemplate with a Control
HyperLink.
I would like to fix many properties of this Control Hyperlink in the Code
Behind. I'm using the Datagrid OnItemCreated Event.
So, I can establish a lot of properties of the Control like that :
--- In the file .aspx, in the Datagrid Control :
OnItemCreated="myDatagrid_ItemCreated"
---- In the code behind file (.aspx .vb)
Sub myDatagrid_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Then
CType(e.Item.FindControl("lnkControl"),
HyperLink).Text="myText"
End If
-->> It's OK.
But I have always the problem with the property NavigateUrl of thisControl
Hyperlink (or CommandArgument property for an another control like
ImageButton).
Question : How can I access to the value of a cell in the DataGrid in the
OnItemCreated Event. I'm referring to thedata bound in the datagrid.
Example of try :
CType(e.Item.FindControl("lnkFamBreDetail"),
HyperLink).NavigateUrl="mapage.aspx?" & Value (of my column bound)
OR CType(e.Item.FindControl("lnkControl"),
Hyperlink).CommandArgument = DataBound
The DataGrid is bound with a DataView (Based on a dataset).
I ' ve try this Felix's Solution (thanks)) but it does not work or i 'm very
stupid :-(
If e.Item.ItemType = ListItemType.Item Then
Dim drvTemp As System.Data.DataRowView
drvTemp = CType(e.Item.DataItem, System.Data.DataRowView)
CType(e.Item.FindControl("lnkControl"),
Hyperlink).CommandArgument = CType(drvTemp.Row.Item("Column"),
System.String) --> Here I have an error. My Column is not recognized.
End if
how referred to the databound?
I'm lost in the deep datagrid ....
Thanks for you help
fabrice
(sorry for my poor english)
First, thanks to felix for his answer.
But :-( , I'm feeling newbie :! I' don't understand all the situation.
The trouble :
Always in the road whith my Datagrid and my ItemTemplate with a Control
HyperLink.
I would like to fix many properties of this Control Hyperlink in the Code
Behind. I'm using the Datagrid OnItemCreated Event.
So, I can establish a lot of properties of the Control like that :
--- In the file .aspx, in the Datagrid Control :
OnItemCreated="myDatagrid_ItemCreated"
---- In the code behind file (.aspx .vb)
Sub myDatagrid_ItemCreated(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.DataGridItemEventArgs)
If e.Item.ItemType = ListItemType.Item Then
CType(e.Item.FindControl("lnkControl"),
HyperLink).Text="myText"
End If
-->> It's OK.
But I have always the problem with the property NavigateUrl of thisControl
Hyperlink (or CommandArgument property for an another control like
ImageButton).
Question : How can I access to the value of a cell in the DataGrid in the
OnItemCreated Event. I'm referring to thedata bound in the datagrid.
Example of try :
CType(e.Item.FindControl("lnkFamBreDetail"),
HyperLink).NavigateUrl="mapage.aspx?" & Value (of my column bound)
OR CType(e.Item.FindControl("lnkControl"),
Hyperlink).CommandArgument = DataBound
The DataGrid is bound with a DataView (Based on a dataset).
I ' ve try this Felix's Solution (thanks)) but it does not work or i 'm very
stupid :-(
If e.Item.ItemType = ListItemType.Item Then
Dim drvTemp As System.Data.DataRowView
drvTemp = CType(e.Item.DataItem, System.Data.DataRowView)
CType(e.Item.FindControl("lnkControl"),
Hyperlink).CommandArgument = CType(drvTemp.Row.Item("Column"),
System.String) --> Here I have an error. My Column is not recognized.
End if
how referred to the databound?
I'm lost in the deep datagrid ....
Thanks for you help
fabrice
(sorry for my poor english)