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?
The code is called from ' row = base.CreateRow(rowIndex, dataSourceIndex, rowType, rowState | DataControlRowState.Edit);' that was listed above.
Mamta MPosted Nov 9, 2011, 11:21 PM
Sie StePosted Nov 9, 2011, 11:52 AM
This does not mean RowState AND DataControlRowState have to have values individually correct?
Mamta MPosted Nov 9, 2011, 1:00 AM
Normal,Alternate, Selected, Edit, Insert
That's why you need to do the bitwise OR using |. Hope it's clear now.
And for the record, this is what MSDN says:
A row's state can be one or a combination of the DataControlRowState values, so use bitwise operations to determine whether the state of the row includes a DataControlRowState value, rather than an equivalence test.
In the line of code you have given, you are creating a new row with a specific row state.
Hope that helps.