Re: Cannot set datagrid Text attribute ????
- From: "Patrick.O.Ige" <naijacoder@xxxxxxxxxxx>
- Date: Wed, 12 Apr 2006 20:52:28 +1000
serge try using template columns in your datagrid and use a control with an
ID
Use findcontrol to get the ID of the control in the itemtemplate in the
OnItemDatabound
And then check and do whatever you want to do
Patrick
"serge calderara" <sergecalderara@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
message news:7A407BB2-291E-419C-B554-7725F1690B3A@xxxxxxxxxxxxxxxx
Dear all,
I have a datagrid which is bind to a databse table.
One field of that table contains a filename.
What I ma trying to do is to display the content of a cell to be an icon
when the database field is not empty. In addition a direct link to the
file
will be done.
Follow is my Datagrid structure for that column:
==============================
<asp:HyperLinkColumn Text="Default" HeaderText="File"
DataNavigateUrlField="DOC_LINK" DataNavigateUrlFormatString="{0}"
Target="_blank">
</asp:HyperLinkColumn>
I have then place code in the ItemDataBound event as below in order to
control appearance of cells before they are displayed.
==========>
If (e.Item.ItemType = ListItemType.Item Or e.Item.ItemType =
ListItemType.AlternatingItem) Then
Dim drv As DataRowView = CType(e.Item.DataItem, DataRowView)
If IsNothing(drv.Row("DOC_LINK")) Or TypeOf
(drv.Row("DOC_LINK")) Is System.DBNull Then
'FileLink = CType(drv.Row("DOC_LINK"), String).ToString
e.Item.Cells(6).Text = String.Empty
Else
e.Item.Cells(6).Text = "<img border=0 src=file.gif>"
End If
End If
Doing this , it does not affect at all the Text attribute of my datagrid
column and the default Text get still displayed.
Then if I replace the line above with :
e.Item.Cells(6).BackColor = Color.Cyan
At this time the cell backcolor is properly set according to the database
field.
How can I affect the Text attribute, whaterver I do does not cjange it
????
THnak for your help
regards
serge
.
- Prev by Date: Re: Signout Problem
- Next by Date: Re: Microsoft XML control: Does it work?
- Previous by thread: Aspnet_compiler with a virtual directory not on the default port
- Next by thread: Using native DLLs not in Path
- Index(es):
Relevant Pages
|