BoldSignEasily embed eSignatures in your .NET applications. Free sandbox with native SDK available.
this.grid.CellClick += new GridCellClickEventHandler(grid_CellClick);
2)Change the QueryCeinfo event.
private void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
{
if(e.ColIndex > 0 && e.RowIndex > 0)
{
//e.Style.CellValue = this.table.Rows[e.RowIndex-1][e.ColIndex-1];
e.Style.CellValue = this.table.DefaultView[e.RowIndex-1][e.ColIndex-1];
e.Handled = true;
}
}
3) Add this cell click handler.
private void grid_CellClick(object sender, GridCellClickEventArgs e) { if(e.RowIndex == 0 && e.ColIndex > 0) { string s = this.table.DefaultView.Sort; string dir = "Desc"; if(s.EndsWith(dir)) dir = ""; if(e.ColIndex == 1) s = "Name"; else if(e.ColIndex == 2) s = "State"; else if(e.ColIndex == 3) s = "Zip"; if(dir != "") s = s + " " + dir; this.table.DefaultView.Sort = s; this.grid.Refresh(); } }
>this.grid.CellClick += new GridCellClickEventHandler(grid_CellClick);
>
>2)Change the QueryCeinfo event.
>
>private void grid_QueryCellInfo(object sender, GridQueryCellInfoEventArgs e)
>{
> if(e.ColIndex > 0 && e.RowIndex > 0)
> {
> //e.Style.CellValue = this.table.Rows[e.RowIndex-1][e.ColIndex-1];
> e.Style.CellValue = this.table.DefaultView[e.RowIndex-1][e.ColIndex-1];
> e.Handled = true;
> }
>}
>
>3) Add this cell click handler.
>>private void grid_CellClick(object sender, GridCellClickEventArgs e) >{ > if(e.RowIndex == 0 && e.ColIndex > 0) > { > string s = this.table.DefaultView.Sort; > string dir = "Desc"; > if(s.EndsWith(dir)) > dir = ""; > if(e.ColIndex == 1) > s = "Name"; > else if(e.ColIndex == 2) > s = "State"; > else if(e.ColIndex == 3) > s = "Zip"; > if(dir != "") > s = s + " " + dir; > this.table.DefaultView.Sort = s; > this.grid.Refresh(); > } >} >