Cell Style 지정하는 방법
방법 1 - 속성으로 제어
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=1093
방법 2 - WebCombo를 사용함 또는 다른방법
http://help.infragistics.com/Help/NetAdvantage/NET/2007.2/CLR2.0/html/WebGrid_Using_Template_Events_in_WebGrid.html
http://samples.infragistics.com/2007.3/webfeaturebrowser/contents.aspx?t=WebGrid/WebComboValueList/WebComboValueList.aspx~srcview.aspx?path=../webfeaturebrowservb/WebGrid/WebComboValueList/WebComboValueList.src~srcview.aspx?path=WebGrid/WebComboValueList/WebComboValueList.src
내가원하는 드롭다운(데모)
버튼클릭시 이벤트
http://forums.infragistics.com/forums/t/3959.aspx
webgrid 초기화함수 (초기화시 세팅하는 부분)
// DropDownList 클릭시 나타날 항목
ValueList valueList = new ValueList(true);
valueList.ValueListItems.Add(1, "test 1");
valueList.ValueListItems.Add(2, "test 2");
valueList.ValueListItems.Add(3, "test 3");
valueList.DisplayStyle = ValueListDisplayStyle.DisplayText;
this.UltraWebGrid1.DisplayLayout.Bands[0].Columns[0].Type = ColumnType.CheckBox; //체크박스로 지정
this.UltraWebGrid1.DisplayLayout.Bands[0].Columns[1].Type = ColumnType.Button; //버튼으로 지정
this.UltraWebGrid1.DisplayLayout.Bands[0].Columns[1].CellButtonDisplay = Infragistics.WebUI.UltraWebGrid.CellButtonDisplay.Always; //버튼계속보이게 설정
this.UltraWebGrid1.DisplayLayout.Bands[0].Columns[2].Type = ColumnType.DropDownList; //드롭다운으로 지정
// 클릭시 이벤트 지정 및 속성 수정가능
this.UltraWebGrid1.DisplayLayout.CellClickActionDefault = CellClickAction.Edit;
this.UltraWebGrid1.DisplayLayout.AllowUpdateDefault = AllowUpdate.Yes;
// DropDownList 리스트값 대입
this.UltraWebGrid1.DisplayLayout.Bands[0].Columns[2].ValueList = valueList;
//this.UltraWebGrid1.DisplayLayout.Bands[0].Columns.FromKey("필드명").ValueList = valueList; //동일한 방법 (생략)
헤드클릭시 checkbox 에 모두 체크하는 js 이벤트
http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.Aspx?ArticleID=5057
HOWTO:WebGrid: How to check all checkboxes in a column when the header is clicked
Summary
This article demonstrates how to loop through the WebGrid rows on the client, then set the values for checkbox cells when a header is clicked within the WebGrid.
Additional Information
The best method for setting the values for all cells in a column when the header is clicked is to handle the client-side ColumnHeaderClick event. Set the handler to be used within the property pages or in code:
In C#:
- UltraWebGrid1.DisplayLayout.ClientSideEvents.ColumnHeaderClickHandler = "UltraWebGrid1_ColumnHeaderClickHandler";
Within that JavaScript handler, first determine which column header was clicked by checking the Key of the column. If the key matches the desired column, loop through the rows and use the setValue() function to change the value of the cell. The following script details how this code should look:
- function UltraWebGrid1_ColumnHeaderClickHandler(gridName, columnId, button)
{ - //Add code to handle your event here.
var myCol = igtbl_getColumnById(columnId); - if (myCol.Key == "Subscriber")
{ - var myGrid = igtbl_getGridById(gridName);
- for (i = 0; i < myGrid.Rows.length; i++)
- {
myGrid.Rows.getRow(i).getCellFromKey("Subscriber").setValue(1);
} - }
- }
Setting a value of 1 (to check) or 0 (to un-check) on a cell using the setValue() client-side function affects the checkbox state when the ColumnType of the column is ColumnType.CheckBox (this is declared at design-time or assigned from server-side code). If the ColumnType was not CheckBox, then setting this value onto a cell would overwrite the checkbox with the literal value '1' or '0'.
이 글은 스프링노트에서 작성되었습니다.