datagrid(master) with a datalist(detail)

Discussion in 'ASP .Net Datagrid Control' started by Esperanza, Feb 8, 2005.

  1. Esperanza

    Esperanza Guest

    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();
    }
    //==========================================================================
    ========
     
    Esperanza, Feb 8, 2005
    #1
    1. Advertising

  2. Esperanza

    Yusuf Guest

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

    "Esperanza" <>, haber iletisinde þunlarý
    yazdý:...
    >
    >
    > 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();
    > }
    > //==========================================================================
    > ========
    >
    >
     
    Yusuf, Mar 9, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Dalberg
    Replies:
    0
    Views:
    395
    John Dalberg
    Dec 20, 2005
  2. asmj
    Replies:
    0
    Views:
    528
  3. Arun Kumar Menon

    Master Detail detail

    Arun Kumar Menon, Aug 6, 2003, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    224
    Arun Kumar Menon
    Aug 6, 2003
  4. Frederik Borg

    ASp.net data binding: Master-detail-detail

    Frederik Borg, Jun 9, 2006, in forum: ASP .Net Datagrid Control
    Replies:
    0
    Views:
    389
    Frederik Borg
    Jun 9, 2006
  5. dh
    Replies:
    2
    Views:
    391
    Jinsong Liu
    Jul 2, 2004
Loading...

Share This Page