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.


*** ASP.BET ***

I'm trying to set BackColor dinamically using this solution:

<asp:GridView ID="GRVW_Exams" DataSourceID="SQLDS_Visite_Esami_TMP" 
AutoGenerateColumns="False" Width="100%" PageSize="5"
                                 AllowPaging="True" DataKeyNames="id_es" 
OnRowDataBound="GRVW_Exams_RowDataBound" >
<AlternatingRowStyle BackColor="Gainsboro" />
<asp:BoundField DataField="id_deg" Visible="false" />
<asp:BoundField DataField="id_es" Visible="false" />
<asp:TemplateField ItemStyle-CssClass="tex1" HeaderText="When" 
<%# func_when(container.dataitem("date_es"))%>


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() 
   Return "#FF9999"
ElseIf datax.ToShortDateString = Date.Now.AddDays(2).ToShortDateString() 
   Return "#FFCCCC"
Else : Return String.Empty
End If
End Function

Protected Sub GRVW_Exams_RowDataBound(ByVal sender As Object, ByVal e As 
  If (e.Row.RowType = DataControlRowType.DataRow) Then
  e.Row.BackColor = Color.FromName(datax(DataBinder.Eval(e.Row.DataItem, 
  End If
End Sub
7/1/2010 8:43:49 AM
dotnet.languages.vb 830 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 6

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 =)

7/1/2010 8:54:48 AM

Similar Artilces:

How do I set up group emails from specific account contacts?
-- Big Tex huh? "GLOVE GUY" <> wrote in message > > -- > Big Tex ...

How do I set up an automatic delete or move of a row of data?
I have a job summary that lists the status of my projects. I want to move the data and close up the gaps in the spreadsheet as I change the status to "complete". You need to provide more information. For example, how do you change the status to complete and where do you want to move the data to? Regards Rowan "Zo" wrote: > I have a job summary that lists the status of my projects. I want to move > the data and close up the gaps in the spreadsheet as I change the status to > "complete". I have a list that identifies the "status" of th...

Setting up News Groups
How do I set up Newsgroups using Outlook 2007? Douglas wrote: > How do I set up Newsgroups using Outlook 2007? > > Douglas > > You don't. Grab a copy of, say, Thunderbird and use that just for Newsgroups. If your ISP allows feeds of Newsgroups set it up through them in Thunderbird. Otherwise sign up for one of the free ones, like Motzarella and set up the Groups from within Thunderbird, using as the News provider. No need to use Thunderbird for anything but the Newsgroups, if that is your fancy. Of course you coul...

OWA settings
Hi am still stuggling with setting OWA up on my 2003 exchange box. Can someone with Exch 2003 check a few settings in IIS for me so I confirm it is setup correctly. When I try to connect via the lAN (for testing purposes) it says access denied. Here are my settings: Default web site is set to anonymous access. Exchange virtual directory is set to Integrated and basic. I have no SSL applied to the site. One thing I have noticed is the defaut application pool is stopped could someone please confirm this is the correct setting. The exchange application pool is running. I am really strugg...

Using an imagebutton and gridview checkbox colunm
I have a gridview were I am using a colunm of checkboxes, if checked I can delete that row. My checkbox code: <asp:ImageButton Id="DeleteMsg" runat="server" ImageUrl="/image/Delete.gif" onclick="DeleteMsg_Click" /> and the event: protected void DeleteMsg_Click(object sender, ImageClickEventArgs e) { } But I keep getting and error: cs1061 "Does not contain a definition for DeletAll... What is wrong with my code? I have asked this same question in the Forum but help as of yet. How do I fix this?...

Hi, I am running exchange 5.5 + SP2 on NT 4.0 + SP6a. I have been running this set up for about 3+ yrs. recently my OWA has started giving troubles. All of sudden it doesn't allow users to connect to Server. Sometimes it just hangs on showing IE is trying connect or sometimes throws LogonFrm.asp errors. When I check in Event Viewer on Exchange Server I find following errors "Error File: /exchange/USA/root.asp Unexpected error" "Error File: /exchange/USA/LogonFrm.asp Unexpected error" The only alternate is to reboot the Exchange server, which is very painful...

Character Set Mix
Hello, I have created my website in my Home PC using Pub2003, before 1 month i have copy all pub-files in my laptop ( i use the same version Pub2003) and i work form there. My websites are mostly in greek language so when i open the pub file in my laptop and i press the ALT-SHIFT to change the language i always get the following message: "If you remap your keyboard to another character set, you may mix characters in your publication. This mix of characters may not show correctly in a browser. If you want to map your keyboard to a different character se pless OK to ...

Auto Number set
Hi, Why when I delete a record and want to create a new record Auto number does not start from last number? any help. thx. -- Message posted via Microsoft Access' Autonumber data type is designed to provide a unique row identifier. Nothing more. Autonumber is generally unfit for human consumption. If you care about the value of the number, don't use Autonumber! What are you trying to use the number for? There may be other approaches. Regards Jeff Boyce Microsoft Office/Access MVP "saman110 via" <u35670@uwe>...

Money Investment QIF import error for Option transactions
I am having trouble importing option transactions within a QIF file. I have narrowed this down to the file and/or process as I've used 2 versions of Money (2003 Deluxe and 2004 Small Business). I tried my normal data file and a new, empty file. Importing a variety of option transactions -- Buy to Open, Sell to Open, Sell to Close, and Buy to Close -- all yielded the same error. I also tried old, expired contracts as well as current option contracts. I am pretty sure that I have imported Option trades like this before, but it has been several months so I cannot remember if I ...

VISIO 2000
hi, using SP 2 Appqarently I can't set the metric system via tools | options | regional settings Well, that is, I *can* change the setting to 'centimeters' - but then .. nothing happens, everything is still in inches.. Please help. Thanks! ep This is a confusing dialog. The setting controls the units for the next drawing you create, not the current one. Go to File > Page Setup to modify the current page. -- Mark Nelson Microsoft Corporation This posting is provided "AS IS" with no warranties, and confers no rights. "ep" <anonymous@t-online....

I get a error code 80070005
Hello can any one help me when i try to install a update or search for one i get this error 80070005 plaese can anyon help me ( i have windows vista home preumim sp1 ) See What anti-virus application or security suite is installed and is your subscription current? What anti-spyware applications (other than Defender)? What third-party firewall (if any)? Has a(another) Norton or McAfee application ever been installed on this machine (e.g., a free-trial version that came prein...

Onchecked_change in gridview
I've a grid view with a checkbox <asp:TemplateField HeaderText="Attiva" HeaderStyle-HorizontalAlign="Center"> <ItemTemplate> <div align="center"> <asp:CheckBox ID="chkAttiva" runat="server" Checked='<%# Eval("Attivta") %>' oncheckedchanged="chkAttiva_CheckedChanged" AutoPostBack="true"></asp:CheckBox> </div> </ItemTemplate> <I...

Saving user account settings to a network folder
I have been able to set Outlook to look to a network folder to see the Outlook file that has the user's mail account set up in it. However, the customized signature and other program settings are not saved in this file (outlook.pst). Is there a way to save all of the customizations to the newtork as well (another file)????? Thank you in advance for your assistance. Hi Jonathan I recently had to upgrade from Ex5.5 to Ex2k and the only way I could do this was to export all the user data to a pst file and import it in to Ex2K. The only draw back was that all the things such as rules...

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", "'pointer';'Gainsboro';'blue'"); e.Row.Cells[4].Attributes.Add("onmouseout", "'black'"); I just added the Gains...

software to switch SMTP settings?
Are there any programs (freeware preferably) that make it easy to switch Outlook settings (basically just SMTP and authentication bs) between a dial-up account and a high-speed account? Thanks LT ...

Setting to default Print Settings
Is it possible to set the default printer settings to be one page across and to have it default to landscape, so i don't need to set it for every excel sheet i print? (using Office 2003) Thanks Ben From a previous post: You could create a workbook that has the settings you want. Then save this workbook as a template for all new workbooks. If that's what you want to do: Start a new workbook. change the margins (and modify it to your heart's content) Also, modify anything else you want as a standard--header/footers, page orientation, number of worksheets in that workbook??? ...

Record is too large. (Error 3047)
I have a relatively large amount of data that I've imported into an Access table and since some of it is survey data (with some relatively verbose open-ended responses) I was not shocked to get this error when I tried to make changes to the table. However, I've deleted these open-ended response fields and am still getting the error. Is there an easy way to track down which field is giving me the issue? -- Kevin Smith Research Associate Hezel Associates, LLC Where? Where are you getting this error? What are you attempting to do when this error shows up? Are you ...

Setting the title
I am having trouble getting the title to display properly on my application. The application is called Circa and I want the the title to be either: "Circa - No File Open" or "Circa - [FileName]". It is an MDI application and I don't really use the CDocument other than for a couple of basic things. I have overridden the SetTitle method on both my CMainFrame class and on my CDocument class. When we arrive in the CDocument::SetTitle, I just pass up the call to MainFrame and the MainFrame decides what the title should be and does SetWindowText, but something else is ...

Regional and Language settings vs default country in Outlook Conta
In Windows XP, Regional and Language Options, I selected "English (US)" in Standards and Options, because I communicate internationality. When I add address details in Outlook 2003 Contacts, the default country is USA. Because I'm based in the Netherlands, I add USA for my US contacts. However Outlook removes the country information "USA", as it is the default country. I need USA on my address details, but I can't get it there. On the other side I get USA as default country (incl. phone country code) when I ommit the country data for Netherland contacts. I woul...

re: Setting up Fees
We have some franchises where we need to invoice them on a monthly basis for rent, franchise fees and upfit charges. I want to invoice through GP, but I am not sure how to setup the items the simplest way with a lot of setup time. Any thoughts? On Jul 23, 10:54 am, Gharmon <> wrote: > We have some franchises where we need to invoice them on a monthly basis for > rent, franchise fees and upfit charges. I want to invoice through GP, but I > am not sure how to setup the items the simplest way with a lot of setup time. > Any thoughts? ...

illegal error
Hi I am using Excel 2000 (Version 9.06 SP3). The excel file is a utility which helps collating data. it keeps crashing and gives a kernel32.dll error Content given below: EXCEL caused an invalid page fault in module KERNEL32.DLL at 017f:bff7b9a6. Registers: EAX=00000000 CS=017f EIP=bff7b9a6 EFLGS=00200246 EBX=00704240 SS=0187 ESP=0062d1a0 EBP=0062d1b4 ECX=00704240 DS=0187 ESI=007042a8 FS=33af EDX=00810ecc ES=0187 EDI=007042a8 GS=0000 Bytes at CS:EIP: ff 76 04 e8 13 89 ff ff 5e c2 04 00 56 8b 74 24 Stack dump: 00704240 708feb88 007042a8 00000000 00810ed0 0062d1f4 708fe28e 00810ed0 0000000d ...

Empty Form Custom Error Msg
I have a form based on a query, and I have sets its proprties of Adding Data and Deleting Data to No. So when the query's result is zero, I get the empty box. Now I want to set up a macro that displays a MsgBox. I don't know what should I write in condition. And secondly in which event should I add the macro since I am refreshing the form with requery command so it can get empty during refreshing too. Thanking you in anticipation. Regards, Hasnain Raja Hi Hasnain, > ... I get the empty box. The empty box? Is this a reference to the white box that is a part of the navigation bu...

Error 1004 when setting range value
I keep getting that Error 1004: Application-defined or object-defined error, when it gets to line: --->Range("res_REVIEWBY").Value = "love" WHYYYY? ----------------------------------------------------------------------------------------------- Private Sub Worksheet_Change(ByVal Target As Range) 'On Error Resume Next On Error GoTo ErrHandler Dim myDoc As Worksheet Set myDoc = ActiveSheet If (Target.Cells.Row >= 5 And Target.Cells.Row <= 6) And Target.Cells.Column = 3 Then Range("res_REVIEWBY").Value = "love" ...

Default Mail Display Settings
I have recently joined an organisation who use Exchange 5.5/and Outlook 2000. As User asked if she could change the settings for all inbound mail to display bigger. No problem I thought...but I can't see how I can do it. I can chnage default outbound settings, heading, column and others. Where is the default mail inbound font setting? Can anybody help? Thanks in advance... Keith ...

printing set-up
I have a spreadsheet that is too wide for landscape (unless i make it really tiny ;-) but it is short (only two or three rows, for example. I was wondering if it possible in some type of setup to have it print say columns a-m on top of a landscape sheet , then print n-al on bottom of same sheet (instead of two pages). thank you. regards, diane One possibilty would be to generate a special print sheet where you have done the folding. otther than that it becomes rather esoteric programming. "Diane" wrote: > I have a spreadsheet that is too wide for landscape (unless i ...