Developer forum

Forum » Development » EditableGrid

Reply
Good Day,

I'm using an EditableGrid but after update, show me this error:

"Multiple controls with the same ID 'ctl01' were found. FindControl requires that controls have unique IDs."

Where can I find examples about EditableGrid?

I'd like build an EditableGrid with insert, update and delete options.


Note: My sqldatasource is ready for insert information but I can't do it, doesn't show errors but nothing happends.


Thanks for your help.

Replies

 
Reply
Hello,

First of all, could you state the version of Dynamicweb that you've updated to?  

When do you get this error - when trying to add new row (via clicking "Click here to add new row" link)? Or you get an error on page load?

It would be very useful if I could see the code that is responsible for filling out the grid.

Regarding an example of usage: we have a C# project that contains samples for all major Dynamicweb controls but the problem is that this project hasn't been updated for quite a while (a lot of new stuff has been changed/added since the last update). There are plans of having this demo project available online meaning that you won't need to download it and run - instead you will have access to a complete set of samples (markup, code-behind, live demo) which should make it much easier to start with using Dynamicweb controls.

-- Pavel
 
Reply
Hi,

Edit and delete are working now, insert doesn't work yet.

Please check the code included and tell me if something is wrong.


Thanks.
 
Reply
Hello,

Your attachment contains only the markup but it would be very useful to see code-behind as well.

Anyway, do you actually handle the "Insert" command? As far as I can tell it doesn't work "out of the box".

The following articles might help:

http://www.aspdotnetfaq.com/Faq/How-to-insert-row-in-GridView-with-SqlDataSource.aspx

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sqldatasource.inserting.aspx

http://www.codeproject.com/KB/aspnet/InsertSqlDataSource.aspx

Also it's important to understand that you basically need to do a bulk insert since you're adding empty rows without the entire page being reloaded (that's the whole point of using this particular control - bulk create/update/delete operations with an AJAX-based management of new rows). Once you're done with setting up values for newly added rows you should "commit" all your changes at once.

The other approach would be to handle NewRowInitialize event (fired by EditableGrid whenever you add a new row) and perform your SQL INSERT in there:

protected void GridLanguage_NewRowInitialize(object sender, Dynamicweb.Controls.EditableGridRowEventArgs e)
{
    // Execute Insert command here
}


Note that the event is fired before the new row is populated on a page so you still need to handle changes made in that row after it's presented to a user (otherwise you'll end up having rows with empty values in your database).

Hope this will clarify things a bit for you.

-- Pavel
 
Reply
Excellent examples. problem fixed.

Thank you!

 

You must be logged in to post in the forum