GridView set BackColor dinamically ERROR!

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
mc
7/1/2010 8:43:49 AM
dotnet.languages.vb 830 articles. 0 followers. Follow

1 Replies
827 Views

Similar Articles

[PageSpeed] 52

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
mc
7/1/2010 8:54:48 AM
Reply:

Similar Artilces:

"Ending Program" error when shut down PC
Am using Outlook 2002 with all new updates as far as I know, on a WinXP-pro PC. Often, when I shut down the PC (Start> Turn-off > Turn-off) a window comes up with a title in the top blue bar of "End Program - OUTLOOK.EXE" and it shows a progress bar while saying "Ending Program...Please wait. (If I don't click the End Now button, the PC won't shut down). By the way, if I do alt/control/del, there will be several OUTLOOK.EXE running under the Processes tab. Is this a bug? Anyone got a fix for this? There's nothing like responding to your own post, but......

EBT settings
i have a problem with EBT( food Stamps) i can accept debit cards but not EBT we set up the tender type. Tender type properties on verification we can not check the EDC (electronic darft capture) is grey and imposible the be check any sugestion will be appreciated. ...

how to set up a mask to enter a code, ie ###-##-####-###-###-##-#.
I need to enter a lot of budget codes that are comprised of groups of numbers separated by a hypen as above where # would equal a specific digit. Can I create an input mask or custom format that would automatically enter the hypen much like the Social Security Number format does? have you tried it. Remeber the 15 limit. So you may want text. -- Don Guillett SalesAid Software donaldb@281.com "CSD Service Desk" <CSD Service Desk@discussions.microsoft.com> wrote in message news:D717A6CB-6697-47D4-855C-E20C668F7795@microsoft.com... > I need to enter a lot of budget codes ...

SDI-app
hi! where is the appropriate point to set the title of a SDI-application - i would like to get rid of the extension "- New" (MyApp - New)... i have tried to set the title within OnActivateView but this does not work for the first time... thanks, philipp You can call SetWindowText() in the OnInitialUpdate() function. Also see http://www.microsoft.com/msj/0198/c0198.aspx -- Cheers Check Abdoul [ VC++ MVP ] ----------------------------------- "Philipp Huber" <philipp.huber@innval.com> wrote in message news:beee26$a9e$04$1@news.t-online.com... > hi...

How do I set up page numbering to count each spread as one page, .
I am trying to count each spread as one page, and only show page numbers on the bottom right of the right hand page. I dont see many detailed options for this. Is there a way to write my own script to determine the page number, such as Miscrosoft has written the # script which displays the page number. Joe <Joe@discussions.microsoft.com> was very recently heard to utter: > I am trying to count each spread as one page, and only show page > numbers on the bottom right of the right hand page. I dont see many > detailed options for this. Is there a way to write my own scrip...

error 2424 message
Hi, My database includes a form for rentals of the department-owned car by employees. This form has a combobox to select the hirer. The NotInList event procedure calls to open in Dialog mode the form to enter a new employee's master data, while the rental form goes invisible. The master data form's cmdSave_Click event procedure hides the form. While the rental form is still invisible, its hirer combo NotInList procedure is then to read from the master data form's key field. That's when error 2424 comes in. The direct window provides this: ? Forms(1).Name, Forms(conNew...

language setting
I need to change my keyboard to an arabic setting and I'm told to install windows xp professional cd rom. HELP, I can't find my cd rom. "rbrooks" <rbrooks@discussions.microsoft.com> wrote in message news:E8EE0A65-0112-405C-BD74-EF64207137D0@microsoft.com... >I need to change my keyboard to an arabic setting and I'm told to install > windows xp professional cd rom. HELP, I can't find my cd rom. I looked around my office and it was not here! I don't think you left it here. On Sat, 13 Feb 2010 16:54:49 -0700, "Richard in AZ"...

Problem with LoadLibrary( 'outlook.exe' ), error 1157
Hi out there, I have a strange problem with Outlook 2000 which occurs on several Win98 systems. When I start Outlook as an application, everything seems fine. But when I try to load Outlook as a library, as in LoadLibrary( '...\Outlook.exe' ) I get an error 1157 (a lib could not be found). The problem is, I cannot find out WHICH!!!! lib cannot be found. How can I force this piece of essential information out of the dumb system? (sorry) The exe itself cannot be the problem. It is there. The path is correct. Can anyone help me? Please note, the LoadLibrary call is used in a thi...

Destroy a modeless dialog causes assertion error
I have a main window and a child which is a modeless dialog (it also has a COM wrapper). The child can response to the OnClose event of the main window. However, when the child response to the main to destroy itself, I got assertion error. Any idea? Thanks. This is my code: if (m_pChildWin && ::IsWindow(m_pChildWin->m_hWnd)) m_pChildWin->DestroyWindow(); It fails at here: OOL CWnd::DestroyWindow() { .... pWnd = (CWnd*)pMap->LookupPermanent(m_hWnd); // Can't find it athough m_hWnd is valid #ifdef _DEBUG hWndOrig = m_hWnd; #endif #ifdef _AFX_NO_OCC_SUPPORT ....

could the #NAME? error be a compatibility issue?
I have a computer with excel '07 and a computer with excel '03. When I view the .xls document in '07, then all the formulas work fine. When I view the .xls document in '03 then several of the formulas display the #NAME? error. halp plz. Look up Analysis ToolPak in help on the pc with 2003 installed, my guess is that you need to install it on the 2003. I believe it gets installed default on 2007 but on 2003 you need to manually install it. Just click tools>add-ins, select Analysis ToolPak and follow the instructions. Note that you need to CD unless it is installed alread...

internal support function error
I am trying to send an email to a group. I switched from outlook express to microsoft outlook. It worked fine in outlook express but is not working in microsoft outlook. Below is the error I am getting. "an internal support function returned an error" Any solutions would be greatly appreciated. I am having the same error. What did you come up with? >-----Original Message----- >I am trying to send an email to a group. I switched from >outlook express to microsoft outlook. It worked fine in >outlook express but is not working in microsoft outlook. >Bel...

Character set not supported??
Dear all, Our email server is EX5.5. I found that some inbound emails contain the following text and its original email (header + body) is putted into a plain text file "message.txt". Why?? How can I fix it? Thank you very much, Keith <Start Quote> This message uses a character set that is not supported by the Internet Service. To view the original message content, open the attached message. If the text doesn't display correctly, save the attachment to disk, and then open it using a viewer that can display the original character set. <<message.txt>> <...

"Rules in Error" doesn't go away. How can I fix this ?
Exh2000, Outlool2002. Run Exmerge and couldn't get rid of "Rules in Error", following article http://support.microsoft.com/?id=262482 How about if I delete user's mailbox and recreate it ? In that case I think I could 1. Export user mailbox to a .pst. 2. Delete mailbox 3. Create a brand new mailbox and Import the .pst file. Should that eliminate the rules ? Let me know what you think about this plan. Marlon, You will be able to eliminate all rules on a mailbox with the steps you have suggested, but you will need to make sure that you uncheck "Associated folder mes...

'Unknown Error' in Entourage Address Book
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: pop Hi <br><br>This problem started for me a few months back, I think after an Office software upgrade...Entourage started crashing, so I did a rebuild of my database (twice) and it has stopped crashing however, I can no longer open my Entourage address book or add anything to it. When I try to open it, it comes up with a message 'Entourage cannot open the item due to an error - An unknown error has occurred in Entourage'. I have also sometimes had a message telling me my da...

gridview in gridview
Hello. I am getting asked to nest a gridview inside a gridview. I know this can be done from all the google examples. But this nest is different in which the nested grid appears between the rows, not as a column like the examples I've seen. Is this possible? If so, any examples/websites that demo this? Thanks. John On Nov 20, 8:31=A0pm, JohnE <Jo...@discussions.microsoft.com> wrote: > Hello. I am getting asked to nest a gridview inside a gridview. =A0I know= this > can be done from all the google examples. =A0But this nest is different i= n > which the ...

Gridview question
I have a web app that use gridview to show data. Can I make it updatable. MSDN says yes. But I can even open the cell to accept input. Can someone give me some pointer. Thanks Yes you can do this and there are tons of examples out there. I would start with this web site: http://www.asp.net/learn/ David ====================================== David McCarter [Microsoft MVP] www.dotNetTips.com David McCarter''''s .NET Coding Standards available at: http://codingstandards.notlong.com "Phil Hunt" wrote: > I have a web app that use gridvi...

Protocol: SMTP, Server Response: '250 HELP', Port: 25, Secure(SSL): Yes, Server Error: 250, Error Number: 0x800CCC7D
I cant receive or send emails in windows mail. What do I have todo? Please copy and paste the error message into the body of your post . . . not the "Subject" line - it got truncated. "valeria migelson" <valemigelson@gmail.com> wrote in message news:eW$sk6#kKHA.4772@TK2MSFTNGP04.phx.gbl... > I cant receive or send emails in windows mail. What do I have todo? Judging by the fragment of the error message you have in the subject = line, it looks like you have the wrong settings for Gmail. Use these: http://mail.google.com/support/bin/answer.py?answ...

Personal Macro File Closing Error
When I close my Personal macro file, I get the error message, "This workbook is currently reference by another workbook and cannot be closed". When I hit OK or close the dialog box, Excel will close. It has no impact on the file itself but is annoying. I'd like to correct this but nothing I've seen addresses this issue. Since Excel 97 a workbook that is referenced (under Tools, References in the Visual Basic Editor) by another open workbook cannot be closed. If the reference is unintentional you should check each open workbook for the reference, remove it and save ...

Set workbook name not working
Hi I am trying to set the workbookname in a sub procedure but it is not working. Her are the part from my code that is not working: Private Sub Start_Click() Dim MalWb as workbook Dim MalTxt as String Set MalWb = Workbooks(ActiveWorkbook.Name) MalTxt = ActiveWorkbook.Name ' Here I have som code to put data into MalWb Call ReskontroArk("Kunder", MalTxt) End Sub Private Sub ReskontroArk(ReskontroType, MalTxt As Variant) Dim MalWb As Workbook Set MalWb = Workbooks(MalTxt) ' run time error 1004. Canot find file End Sub Can someone ...

How to set focus to the previous app that had it?
When my app first starts, it's going to grab the focus. I want to immediately give focus back to the previous app that had it Also, if somebody uses the mouse to interact with my app (drag etc), it will again grab the focus. When the user is done dragging, I'd again like to immediately give focus back to the app it grabbed it from. Any suggestions? Kerry "Kerry" <Kerry@discussions.microsoft.com> wrote in message news:7BD48F63-F7D5-4EB9-B38A-84A6C357231A@microsoft.com... > When my app first starts, it's going to grab the focus. I want to > immediatel...

Error mounting mail volume
Hi, I have a problem with my Exchange 2003. After a crash of my AD I want to restore my old priv1.edb and priv1.stm. I had to reinstall my server 2003. After that I reinstalled my Exchange 2003. I've tried to use the old names as much as possible. When I copied my old priv1.edb and priv1.stm over the original files i received the next message: ID no: c1041739 Exchange System Manager How can I use my old files so I have my mail back. Who can help me to solve my problem. I have a new installation created in a vmware environment, with the the same settings as my normal Active Directory, ...

How do you copy dropdownlist to GridView
I am trying to copy the Value and Text column of a DropDownList to a GridView. With my GriView: <asp:GridView ID="GridView2" runat="server"> <Columns> <asp:TemplateField> <ItemTemplate> <asp:Label ID="lblJobs" runat="server" /> </ItemTemplate> </asp:TemplateField> <asp:TemplateField> <ItemTemplate> <asp:DropDownList ID="ddlBuckets" runat="se...

error C2143: syntax error : missing ';' before '<'
I keep on getting this error..it points to this line ... const UnboundedSetByValue<Semester> getEnrolledSemesters() const; the line also produces his error error C2059: syntax error : '<' ...

outlook.exe has generated an error and wil be closed by windows
I get this message averytime I accept an appointment in Outlook 2000. Any suggestions gratefully recieved. I have tried:- Deelscting the Add-ins Creatine a new outlook profile Removing the two outlook folders in his profile Creating a new W2K profile thanks Werner >-----Original Message----- >I get this message averytime I accept an appointment in Outlook 2000. > >Any suggestions gratefully recieved. > >I have tried:- > >Deelscting the Add-ins >Creatine a new outlook profile >Removing the two outlook folders in his profile >Creating a new W2K prof...

styling in a gridview
I have a gridview that has a column that changes color onmouseover. But, I need to have the row return back to the original color in the onmouseout. The rows alternate backgroundcolor. Here is the code (_RowDataBound) that is currently in play; e.Row.Cells[4].Attributes.Add("onmouseover", "this.style.cursor='pointer'; this.style.backgroundColor='Gainsboro'; this.style.color='blue'"); e.Row.Cells[4].Attributes.Add("onmouseout", "this.style.color='black'"); I just added the Gains...