|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
datagrid(master) with a datalist(detail)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(); } //========================================================================== ======== You don't need this line:DataGrid1.SelectedItem = e.Item.ItemIndex
because it already has its value e.item.itemindex "Esperanza" <esperanza***@hotmail.com>, haber iletisinde þunlarý yazdý:uJolN3fDFHA.3***@TK2MSFTNGP15.phx.gbl...Show quoteHide quote > > > 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(); > } > //========================================================================== > ======== > > |
|||||||||||||||||||||||