datagrid(master) with a datalist(detail)

E

Esperanza

Hello everybody,
I want to do a master detail web form.
I've made a datagrid as a master and put a datalist below which will show up
the details information. I choose a datalist for the details informations
because, I have many columns and don't want to have it display as a row.

I've got the following line in error :
DataGrid1.SelectedItem = e.Item.ItemIndex
Saying :
Property or indexer 'System.Web.UI.WebControls.DataGrid.SelectedItem' cannot
be assigned to -- it is read only

Why it says it is read only, the column is not in readonly.

Thanks in advance !!
Esperanza
New to .net

Here is my code :
//==============================================
private void Page_Load(object sender, System.EventArgs e)
{
DataGrid1.DataSource = dataViewGPPL;
DataGrid1.DataKeyField = "GLNOCLI";
DataGrid1.DataBind();
}
//============================================


//==========================================================================
========
private void DataGrid1_ItemCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataGrid1.SelectedItem = e.Item.ItemIndex;
int intPrimaryKey = (int)DataGrid1.DataKeys[e.Item.ItemIndex];
this.sqlDataAdapResultatsHys.SelectCommand.Parameters["@NoClient"].Value
= intPrimaryKey;
DetailsDataList.DataSource = dataSetResultatsHys;
DetailsDataList.DataBind();
}
//==========================================================================
========
 
Y

Yusuf

You don't need this line:DataGrid1.SelectedItem = e.Item.ItemIndex
because it already has its value e.item.itemindex
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top