Hi
Ive got a custom collection of class which I use as the data source for a
DataGrid control.
I execute the following code prior to beginning my data binding:
if (list_[0] is BatchWorkItem) { ....} // do stuff
This evaluates to true.
I then execute the DataBind() method for the datagrid. In my handler for
ItemDataBound. Within the event handler I execute the same code, however this
time is evaluates to false.
After the DataBinding is complete, I again execute that expression and it
evalutes to true.
During this time I don't perform any operations of the datasource, nor the
contents.
The full code listing is as follow:
In Page Load (Not post back condition)
if (listSource_[0] is BatchWorkListIt em) {
// compiler steps in
}
// populate the data grid.
populateGrid();
if (listSource_[0] is BatchWorkListIt em) {
// compiler steps in
}
The following are the handler method(s)
private void populateGrid() {
workListGrid.Da taSource = listSource_;
workListGrid.Da taKeyField = "ID"; // Property of BatchWorkListIt em
workListGrid.Da taBind();
}
private void workListGrid_It emDataBound(obj ect sender,
System.Web.UI.W ebControls.Data GridItemEventAr gs e) {
// check what type and activity the work list items is for the
// navigation URL
switch (e.Item.ItemTyp e) {
case ListItemType.Al ternatingItem :
// force a fall-through.
goto case ListItemType.It em;
case ListItemType.It em :
resolveProceedU rl(e.Item.ItemI ndex);
break;
}
}
private void resolveProceedU rl(int index) {
// hard coded index for debugging purpose
if (listSource_[0] is BatchWorkListIt em) {
// compiler doesn't step in here
}
}
When I add watches to the datasource, I don't see any changes on the
contents during the binding process.
Thanks in advance for the assistance..
Ive got a custom collection of class which I use as the data source for a
DataGrid control.
I execute the following code prior to beginning my data binding:
if (list_[0] is BatchWorkItem) { ....} // do stuff
This evaluates to true.
I then execute the DataBind() method for the datagrid. In my handler for
ItemDataBound. Within the event handler I execute the same code, however this
time is evaluates to false.
After the DataBinding is complete, I again execute that expression and it
evalutes to true.
During this time I don't perform any operations of the datasource, nor the
contents.
The full code listing is as follow:
In Page Load (Not post back condition)
if (listSource_[0] is BatchWorkListIt em) {
// compiler steps in
}
// populate the data grid.
populateGrid();
if (listSource_[0] is BatchWorkListIt em) {
// compiler steps in
}
The following are the handler method(s)
private void populateGrid() {
workListGrid.Da taSource = listSource_;
workListGrid.Da taKeyField = "ID"; // Property of BatchWorkListIt em
workListGrid.Da taBind();
}
private void workListGrid_It emDataBound(obj ect sender,
System.Web.UI.W ebControls.Data GridItemEventAr gs e) {
// check what type and activity the work list items is for the
// navigation URL
switch (e.Item.ItemTyp e) {
case ListItemType.Al ternatingItem :
// force a fall-through.
goto case ListItemType.It em;
case ListItemType.It em :
resolveProceedU rl(e.Item.ItemI ndex);
break;
}
}
private void resolveProceedU rl(int index) {
// hard coded index for debugging purpose
if (listSource_[0] is BatchWorkListIt em) {
// compiler doesn't step in here
}
}
When I add watches to the datasource, I don't see any changes on the
contents during the binding process.
Thanks in advance for the assistance..