Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 2.0 and Visual Studio. 2005 > Visual Studio 2005
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old August 15th, 2007, 09:56 AM
Authorized User
 
Join Date: Jun 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to preetham.sarojavenkatesh
Default details about datagrid_itemdatabound

can anyone,
                 plz explain m about the working procedure of datagrid_itemdatabound..plz

preet
__________________
preet
 
Old August 15th, 2007, 10:17 AM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

It is the event that is raised when an item is databound from a given data source. Offical MSDN documentation: http://msdn2.microsoft.com/en-us/lib...databound.aspx

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old August 16th, 2007, 03:01 PM
Authorized User
 
Join Date: Jun 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to preetham.sarojavenkatesh
Default

can,u plz b more specific like-what can be done to colour the particular column in the datagrid,how to find total of all salaries of employees..etc,etc...
           i searched in google-but all of them was vain!

preet
 
Old August 16th, 2007, 03:31 PM
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

The itemDataBound event will only have reference to a particular row in your grid so unless the total salary of all employees exist in all rows, you wont have access to that information. Something like this is how you would loop through the items:

if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem || e.Item.ItemType == ListItemType.EditItem)
            {
                DataRowView rv = (DataRowView)e.Item.DataItem;
                DateTime dt = Convert.ToDateTime(rv.Row.ItemArray[0]);

                if (DateTime.Compare(DateTime.Now, dt) > 0)
                {
                    for(int i=0; i < e.Item.Cells.Count; i++)
                    {
                        e.Item.Cells[i].CssClass = "cssclass";
                    }
                }
            }

This code grabs an element that appears in element 0 (presumably a date) and checks to see if the value comes before todays date, if it has it loops through all the cells in the grid of that row and applies a style to it. Conceiveably this style could turn the column a certain color.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for:
Professional Search Engine Optimization with ASP.NET

Professional IIS 7 and ASP.NET Integrated Programming

================================================== =========
 
Old August 21st, 2007, 12:32 PM
Authorized User
 
Join Date: Jun 2007
Posts: 25
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to preetham.sarojavenkatesh
Default

yeah buddy,
                thanks 4 the reply-but im n2 able to access this datarowview(its giving an error!!)...

preet





Similar Threads
Thread Thread Starter Forum Replies Last Post
File Details ricespn Beginning VB 6 9 April 20th, 2007 01:48 PM
Regarding Details View aekta ASP.NET 2.0 Professional 0 March 10th, 2007 11:46 PM
Details Height Paula222 Access VBA 1 April 11th, 2006 11:27 AM
submit details slick704 Javascript How-To 0 June 10th, 2005 01:00 AM
Problem Details 3Moose BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 16th, 2005 10:42 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.