Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   datagrid(master) with a datalist(detail) (http://www.velocityreviews.com/forums/t761587-datagrid-master-with-a-datalist-detail.html)

Esperanza 02-08-2005 04:46 PM

datagrid(master) with a datalist(detail)
 


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.Paramet ers["@NoClient"].Value
= intPrimaryKey;
DetailsDataList.DataSource = dataSetResultatsHys;
DetailsDataList.DataBind();
}
//================================================== ========================
========



Yusuf 03-09-2005 12:03 PM

Re: datagrid(master) with a datalist(detail)
 
You don't need this line:DataGrid1.SelectedItem = e.Item.ItemIndex
because it already has its value e.item.itemindex

"Esperanza" <esperanza222@hotmail.com>, haber iletisinde şunları
yazdı:uJolN3fDFHA.3120@TK2MSFTNGP15.phx.gbl...
>
>
> 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.Paramet ers["@NoClient"].Value
> = intPrimaryKey;
> DetailsDataList.DataSource = dataSetResultatsHys;
> DetailsDataList.DataBind();
> }
> //================================================== ========================
> ========
>
>





All times are GMT. The time now is 11:24 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.