본문 바로가기
Program

Practical use of the DataGrid's ItemDataBound event

본문

Introduction

Because of its simplicity, flexibility and many possible uses, the DataGrid class is one of the most well known and used classes of the .NET framework. The use of the DataGrid's ItemDataBound event introduces a whole new world of possibilities, letting you conditionally modify displayed data, format, as well as insert some client side code for any cell in your DataGrid. The use of this event can sometimes be a smart alternative to adding calculated columns to a dataset.

 

The source code available for this tutorial is a working example of what you can do with the ItemDataBound event; a DataGrid displays customer information, a balance value is displayed in red if its value is negative. For the sake of this tutorial, we'll pretend that Jamaica has invaded the North American continent, so North American countries are displayed as "Jamaica" with the insertion of client side code to create a hyperlink and map this link's onClick event to a JavaScript function (popup window). The source code contains an Access database and two web forms; the DataGrid and a form letting the user view complete details of the customer in the popup window.

 

Sample Image

Background

The ItemDataBound event happens once for every row, after the data is bound to the DataGrid and before the page is rendered to the client.

Using the code

 
 

Points of Interest

The ItemCreated event is a close sibling of ItemDataBound. This event happens before ItemDataBound, when the row is created but does not yet contain any data, so you can't use it to read or modify data.

 

http://www.codeproject.com/

[이 게시물은 듀라님에 의해 2015-04-03 10:08:13 워드프레스에서 이동 됨]
[이 게시물은 듀라님에 의해 2015-04-03 10:27:24 Public에서 이동 됨]
[이 게시물은 듀라님에 의해 2015-04-03 10:33:53 팁과강좌에서 이동 됨]
[이 게시물은 최고관리자님에 의해 2017-06-10 14:24:49 ASP.net에서 이동 됨]
0 0
  • 페이스북으로 보내기
  • 트위터로 보내기
  • 구글플러스로 보내기
  • 카카오톡으로 보내기

페이지 정보

l2j (121.♡.101.20) 작성일07-05-03 02:58 조회1,724회 댓글0건

댓글목록

등록된 댓글이 없습니다.

Program 목록

게시물 검색

사이트 정보

  • 회사명 회사명 / 대표 대표자명
  • 주소 OO도 OO시 OO구 OO동 123-45
  • 사업자 등록번호 123-45-67890
  • 전화 02-123-4567 / 팩스 02-123-4568
  • 통신판매업신고번호 제 OO구 - 123호
  • 개인정보관리책임자 정보책임자명

고객센터

  • 02-1234-5678
  • abc@abc.com
  • 월-금 am 11:00 - pm 05:00
  • 점심시간 : am 12:00 - pm 01:00
  • 주말&공휴일은 1:1문의하기를 이용하세요.
상단으로