|
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.
|
|
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\_i7Thanks!
|
|
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!.
|
|
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!
|
|
Rank: Member Groups: Member
Joined: 11/20/2008 Posts: 14
|
Hi,
Ok I agree, I´ll check my code.
Thanks!.
|
|
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.
|
|
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.
Thanks a lot !
|
|
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!
|
|
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.
|
|