3
Reply

Gridview logic question

Sie Ste

Sie Ste

Nov 8 2011 12:21 PM
1.9k
Since I am new to working on C# webforms 2010, I have the following questions to ask so I can understand what is occuring in the following code:

1. In the code listed below, what does the '|' mean in the line  'rowState | DataControlRowState.Edit'? In addition can you explain what is occuring in the line of code for 'row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState | DataControlRowState.Edit);'


  protected override GridViewRow CreateRow(int rowIndex, int dataSourceIndex, DataControlRowType rowType, DataControlRowState rowState)
  {
  GridViewRow row;

  if (this.BulkEdit)
  row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState | DataControlRowState.Edit);
  else
  row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState);

  return row;
  }

2. In the aspx file, I see the following Namespace="BulkEditGridView". Can you explain or point me to a reference show I can understand how the "BulkEditGridView" namespace is wired into making the webpage work?

<%@ Page Title="" Language="C#" MasterPageFile="~/ModuleBase.master" AutoEventWireup="true" CodeBehind="Manage.aspx.cs" Inherits="Support.Manage"
<%@ Register Assembly="Support" Namespace="BulkEditGridView" TagPrefix="test" %>

3. When I step through the code, I see the following items being referred to in the .aspx file. Can you explain what is occurring?

<ItemTemplate>
  <asp:CheckBox ID="chkL" OnCheckedChanged="CheckRoleChanged" AutoPostBack="true"
  Checked='<%# Convert.ToBoolean( Eval ("L")) %>' runat="server" />
  </ItemTemplate

The code is called from ' row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState | DataControlRowState.Edit);' that was listed above.


Answers (3)