Enterprise Portal Gridview problem

To whom it may concerns,

Currently I have come across a problem when adding a new line AxGridView when there is a header and line relationship.

Background:

  1. I have two grids in my user control. One for the header, and the other for the line (they are joined with active join).

  2. when the selected index of the header grid changed, the line grid changed respectively…up to now, all the behavior works very fine to me.

Problems:

  1. When I clicked the button (“button1” from below code) to create a new line in the grid. The DataKeyNames fields are usually lost and thus the line cannot be inserted. This case usually happens on the second time I click the button, which is the datakeynames fields didn’t lost on the first new line.

  2. I have set the session timeout = “5000” in web.config, which I think the session won’t expire easily in my case.

  3. More than that, I turn all fields (including the DataKeyNames fields) to be “Allow Edit” in AX and “ReadOnly=false” in EP. Each field in the grid is set “AutoPostBack=True” and “UpdateOnPostBack=true” for the grid.

So, are there anything I was missing? or I did anything wrong that causes the error? or any ways I can solve the problem? My coding is as below.

private AxDataSourceView testDataSourceView;

AxDataSourceView TestDataSourceView
{
get
{
if (testDataSourceView== null)
testDataSourceView= this.AxDataSource.GetDataSourceView(this.AxGridViewLine.DataMember);

return testDataSourceView;
}
}

void Button1(object sender, EventArg e)
{

TestDataSourceView.AddNew();

}

Thanks very much!!!

Best,

Stray