DataBind

  • Thread starter Thread starter Calvin Lai
  • Start date Start date
C

Calvin Lai

Hi all,

Say I have a DataTable object (oDT) resting on the ViewState object. And I
have a button called AddButton and a DataGrid, which its datasource is the
oDT.

If I want my app behaves so that whenever the user clicked the AddButton,
internally (server side) will add a row into the oDT and the DataGrid will
reflect such changes, AND, with that newly added row as editable.

I have tried many different ways but still no hope. Below is my code
snipplet.

AddButton_Click()
{
oDT.Rows.Add(oDT.NewRow());
oDG.Datasource = oDT;
oDG.DataBind();
oDG.EditeItemIndex = oDT.Rows.Count;
....
}

and it doesn't work...please help.

Calvin
 
I'm providing a link to attach a row to a datagrid. Then you would need to
set the edit item index to the row depending on where you add it, the index
may vary
http://tinyurl.com/ytvrg
 

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

Back
Top