Beispiel #1
0
 protected virtual void OnErrorColumnCreated(ErrorRowCreatedEventArgs args)
 {
     if (ErrorRowCreated != null)
     {
         ErrorRowCreated(this, args);
     }
 }
Beispiel #2
0
        private void GridView_OnRowCreated(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType != DataControlRowType.DataRow)
            {
                return;
            }
            TableCell cell = null;

            if (AllowErrorColumn)
            {
                cell = e.Row.Cells[gridView.Columns.Count - 1];
            }
            var  index = e.Row.RowIndex;
            long?id    = null;

            if (DataKeyNames.Length == 1 && e.Row.DataItem != null)
            {
                id = (long)DataBinder.Eval(e.Row.DataItem, DataKeyNames[0]);
            }
            var args = new ErrorRowCreatedEventArgs(cell, index, id);

            OnErrorColumnCreated(args);
            if (AllowErrorIconColumn)
            {
                foreach (var iconUrl in args.ErrorIconUrls)
                {
                    e.Row.Cells[1].Controls.Add(new Image {
                        ImageUrl = iconUrl
                    });
                }
            }
        }