Very Simple DataGrid Question

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • James

    #1

    Very Simple DataGrid Question

    I have a very simple datagrid, with an edit button that I added in
    PropertyBuilder . This fires the EditCommand event just fine and I show a
    panel where the user can edit certain fields. I have a button to save the
    changes. Within that button, I refer to dataGrid1.EditI temIndex and it's
    returning -1. Isn't this property set when I click on the edit button
    within the grid?


  • James

    #2
    Re: Very Simple DataGrid Question

    Scratch that question, I'm an idiot. My real question is that I don't want
    to do editing within the grid, I want to populate controls outside of the
    grid and then save/rebind.

    I'm able to handle the Edit Command and populate the controls, but when I
    want to save it back to the dataset, I need to refer to the record that was
    selected within the grid. How can I refer to the item that was selected
    within my grid, without setting something explicitly in a session variable
    or something like that?


    "James" <minorkeys@gmai l.com> wrote in message
    news:ONt4VVN0FH A.2348@TK2MSFTN GP15.phx.gbl...
    [color=blue]
    >I have a very simple datagrid, with an edit button that I added in
    >PropertyBuilde r. This fires the EditCommand event just fine and I show a
    >panel where the user can edit certain fields. I have a button to save the
    >changes. Within that button, I refer to dataGrid1.EditI temIndex and it's
    >returning -1. Isn't this property set when I click on the edit button
    >within the grid?
    >[/color]


    Comment

    • Cor Ligthert [MVP]

      #3
      Re: Very Simple DataGrid Question

      James,

      In my opinion is this a WebForm datagrid. It is again a while ago I used
      that, however in my opinion do you have first to select the row and than you
      can use the other buttons.

      It is nicely explained on MSDN in this page

      http://msdn.microsoft.com/library/de...dWriteData.asp

      I hope this helps,

      Cor

      "James" <minorkeys@gmai l.com> schreef in bericht
      news:ONt4VVN0FH A.2348@TK2MSFTN GP15.phx.gbl...[color=blue]
      >I have a very simple datagrid, with an edit button that I added in
      >PropertyBuilde r. This fires the EditCommand event just fine and I show a
      >panel where the user can edit certain fields. I have a button to save the
      >changes. Within that button, I refer to dataGrid1.EditI temIndex and it's
      >returning -1. Isn't this property set when I click on the edit button
      >within the grid?
      >[/color]


      Comment

      Working...