User Profile & Activity

Darren Budd Member
Page
of 2

Hi Yudi,

Ive attached an image showing what is happening in the webgrid.  It never gets passed this stage.

I noticed you see the same problem in the WebGrid sample >> Client_ProgrammaticEdit (which Handy pointed me to above), when I click on "Add New Row" then clicking "insert" withouth adding any values. 

 

Also, another piece of information.  Although I dont want to update the data source when I add a row, the grid Im using IS  databound (to a datatable based on sql server query results).  As a test, I tried binding the grid to a data table i manually created in code, and the add row functionality worked.  On binding to the sql data sourceagain, it doesnt.  Ive attached the aspx page and code behind for my test page.

 

thanks again

 

Darren

 

Hi Handy,

 

Thanks for the advice.  Im not too sure what you mean by "select or mark edit the new row"?  Do you mean the user has to select something within the grid?

Ive taken a look a the Client_ProgrammaticEdit page, and it looks pretty much the same as the code I have - ie (code from Client_ProgrammaticEdit):

 

var newRow = grid.RootTable.NewRow(); var cells = newRow.GetCells() ; cells.GetNamedItem("CustomerID").SetText(customerIDText.value, true); ............

..........................

 

newRow.Update(); // insert new record

// insert new record

 

 

My code:

 

var newRow = grid.RootTable.NewRow(); var cells = newRow.GetCells() ; cells.GetNamedItem("itmText").SetText("some value", true); cells.GetNamedItem("itmID").SetText(-1,true);

newRow.Update();

 

 

this still doesnt work for me, can you offer any more advice?

 

thanks again

Thanks Glenn, that makes sense, and has solved my problem.

Hi Andi,

 

thanks for that, its sorted my problem. Seems I was just taking the wrong approach to data binding!

 

thanks again.

 

Darren

Hi Andi,

thanks for the response.  This now works for me, using the Hide and Show methods as you do in your example.  I was setting the visible property before, which wasnt working.

 

thanks again

 

Darren

Hi Handy,

 

That works for me.  I dont think I saw anything in the sample code or documentation on using Page_Init for data binding, but maybe I missed something.

 

Thanks for your help!

 

Darren

Hi,

 

Id like to add to this thread.  I too am having problems with the treeview "disappearing" after a standard postback.  I have a treeview, which I am binding to an xml data source.  The datasource is generated dynamically from code behind when the page loads.  This is all fine, but, as i say, the tree disappears on postback.

All times are GMT -5. The time now is 12:55 PM.
Previous Next