Welcome Guest Search | Active Topics | Sign In | Register

Using AddedItems Event Options
KarL
Posted: Wednesday, March 4, 2009 2:36:51 PM
Rank: Member
Groups: Member

Joined: 11/20/2008
Posts: 14
Hi,

I´m working with the essential grid but Im so stuck with this, please could you give me a little help. The thing its that Im trying to use the AddedItems Event, I think thath im using it well but i cant figure it out why it doesnt work.


protected void Button1_Click(object sender, EventArgs e)
{

foreach (EO.Web.GridItem item in Grid1.AddedItems)
{
string NoCuenta = (string)item.Cells[1].Value;
string descrip = (string)item.Cells[2].Value;
Label1.Text += NoCuenta;
Label2.Text += descrip;


}
/* int filas = Grid1.Items.Count;
for (var i = 0; i < filas; i++)
{
GridItem item = Grid1.Items[i];
Label1.Text += item.Cells[1].Value;
}*/

}

I think that Im using it well as I told you before but when I run this code the AddedItem returns a 0 when I add a row. The only way that I could catch it was with the comented code bellow by using Items.Count, also I´ve been trying with and without callbackPanel. Im sorry for being so annoying.

Thanks for any help.
eo_support
Posted: Wednesday, March 4, 2009 2:55:48 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

I do not know what you mean by "AddedItem returns a 0". The only thing I can spot in your code is that your Label1 and label2 will always only display information for the last added items no matter how many items you add.

You can take a look of this sample and see if it works for you:

http://demo.essentialobjects.com/Default.aspx?path=Grid\_i1\_i7

Thanks!
KarL
Posted: Wednesday, March 4, 2009 2:57:26 PM
Rank: Member
Groups: Member

Joined: 11/20/2008
Posts: 14
Hi again,

I did another test that I saw in previous post, I remove the custom column that I had on the grid and it work but i still dont understand why the dropdown list in the grid causes this behavior, everything its exactly as I found it in your documentation. Please help me with this.

Thanks!.
eo_support
Posted: Wednesday, March 4, 2009 3:04:15 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

In that case it will most likely have to do with your custom column code. Our support will not troubleshoot user code. If you believe it is a Grid problem, you can create a test page that reproduces the problem and post the test page along with detailed steps to reproduce the problem.

Thanks!
KarL
Posted: Wednesday, March 4, 2009 3:17:55 PM
Rank: Member
Groups: Member

Joined: 11/20/2008
Posts: 14
Hi,

Ok I agree, I´ll check my code.

Thanks!.
KarL
Posted: Wednesday, March 4, 2009 4:20:28 PM
Rank: Member
Groups: Member

Joined: 11/20/2008
Posts: 14
Hi again,

Just one last question, why can i use fine the events ChangedItems and DeletedItems with custom column, even if i have in the same button the events changedItems, deleteItems and AddedItems, the two first ones works fine but the other doesnt.

So many thanks.

KarL
Posted: Thursday, March 5, 2009 1:04:49 PM
Rank: Member
Groups: Member

Joined: 11/20/2008
Posts: 14
Hi again,

This my code, I notice that when im using a custom colum with a dropdown list the additem event reset the index because of the postback. So i need to know if its not posible to use a custom colum whith the event additem.

Code: C#
Removed by admin


Thanks a lot !
eo_support
Posted: Thursday, March 5, 2009 1:12:50 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,194
Hi,

Your code has been deleted because it references your own database and we can not run it here. Please create a test page that runs independently.

Also, you have pasted your DB connection string with your database user name and password in a public forum. I am not sure how your database administrator will think about that.

Once again, create a test page. Do not just post your code as is. We can't do anything without being able to run it, not to mention that we do not debug user code.

Thanks!
KarL
Posted: Thursday, March 5, 2009 1:25:34 PM
Rank: Member
Groups: Member

Joined: 11/20/2008
Posts: 14
hi,

Ok, I´m sorry for the inconvenient. I´ll create an independent test page and I think that I have to put the link, right?


Thanks a lot for the comments.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.