Hi all,
as specified in the subject. I get this errore message:
"DataBinding: 'System.Data.DataRowView' does not contain a property with
the name 'date_es'"
I don't know what it could be! :(
Any help would be appreciated, thanks in advance.
MC.
*** ASP.BET ***
I'm trying to set BackColor dinamically using this solution:
<asp:GridView ID="GRVW_Exams" DataSourceID="SQLDS_Visite_Esami_TMP"
runat="server"
HorizontalAlign="Center"
AutoGenerateColumns="False" Width="100%" PageSize="5"
AllowPaging="True" DataKeyNames="id_es"
OnRowDataBound="GRVW_Exams_RowDataBound" >
<AlternatingRowStyle BackColor="Gainsboro" />
<Columns>
<asp:BoundField DataField="id_deg" Visible="false" />
<asp:BoundField DataField="id_es" Visible="false" />
<asp:TemplateField ItemStyle-CssClass="tex1" HeaderText="When"
ItemStyle-Width="30%">
<ItemTemplate>
<%# func_when(container.dataitem("date_es"))%>
</ItemTemplate>
</asp:TemplateField>
etc.
*** BEHIND CODE ***
Function datax(ByVal datax As Date) As String
If datax.ToShortDateString = Date.Now.ToShortDateString Then
Return "#FF3333"
ElseIf datax.ToShortDateString =
Date.Now.AddDays(-1).ToShortDateString() Then
Return "#CCCCCC"
ElseIf datax.ToShortDateString = Date.Now.AddDays(1).ToShortDateString()
Then
Return "#FF9999"
ElseIf datax.ToShortDateString = Date.Now.AddDays(2).ToShortDateString()
Then
Return "#FFCCCC"
Else : Return String.Empty
End If
End Function
Protected Sub GRVW_Exams_RowDataBound(ByVal sender As Object, ByVal e As
GridViewRowEventArgs)
If (e.Row.RowType = DataControlRowType.DataRow) Then
e.Row.BackColor = Color.FromName(datax(DataBinder.Eval(e.Row.DataItem,
"data_es").ToString()))
End If
End Sub
|
|
0
|
|
|
|
Reply
|
mc
|
7/1/2010 8:43:49 AM |
|
Argh, sorry, there were a couple of very silly mistakes :)
- "date_es" -> "data_es"
- I was pointing to the GridView's name insted of the data source's one.
Now it works =)
|
|
0
|
|
|
|
Reply
|
mc
|
7/1/2010 8:54:48 AM
|
|