Update Challenge on Datagrid
-
Hi All: I code in VB.NET I have a funny issue.I have an Datagrid with a few bound columns and also an edit column.This edit column works and i have the update and cancel buttons come up when i click on edit. Then i also have the update function written in the Code Behind Page.Thsi function works because when i tell it to writhe SQL update statement on a label it writes it out.But my challenge is on the update mode any value that i update on a column does not get reflected after i press the update column. For eg:- if i change a column from 1/1/1900 to 10/16/2000 which is princiapply the update i want to make the sql statement that runs on the database contains only the old value 1/1/1900.It is as though it's not being able to pick up the change i make in the edit mode. If some body could tell me why this is happening that would be great.Anything that i have to modify in the datagrid or something If a Building is Completed then why do they call it BUILDING ??
-
Hi All: I code in VB.NET I have a funny issue.I have an Datagrid with a few bound columns and also an edit column.This edit column works and i have the update and cancel buttons come up when i click on edit. Then i also have the update function written in the Code Behind Page.Thsi function works because when i tell it to writhe SQL update statement on a label it writes it out.But my challenge is on the update mode any value that i update on a column does not get reflected after i press the update column. For eg:- if i change a column from 1/1/1900 to 10/16/2000 which is princiapply the update i want to make the sql statement that runs on the database contains only the old value 1/1/1900.It is as though it's not being able to pick up the change i make in the edit mode. If some body could tell me why this is happening that would be great.Anything that i have to modify in the datagrid or something If a Building is Completed then why do they call it BUILDING ??
You are actually coding the update, right? Not just expecting it to do itself? If so, are you rebinding the data afterwards? Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito Song -
You are actually coding the update, right? Not just expecting it to do itself? If so, are you rebinding the data afterwards? Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito SongHi Paul: Yes i am doing the update.Infact on the update section of the code i have a statement ,that will print out on a label on the form, the actual sql statement that was executed on the database.It is in this statment thati found out that the update statements take only the old values and not the new values that i changed. Yes i do refresh the datagird.What i do after update is , iset the edititem index to -1. Then i populate a dataset with a stored procedure that is same as the on in the page load event and bind this dataset to the datagrid. All this is done on the update section of the code. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??
-
Hi Paul: Yes i am doing the update.Infact on the update section of the code i have a statement ,that will print out on a label on the form, the actual sql statement that was executed on the database.It is in this statment thati found out that the update statements take only the old values and not the new values that i changed. Yes i do refresh the datagird.What i do after update is , iset the edititem index to -1. Then i populate a dataset with a stored procedure that is same as the on in the page load event and bind this dataset to the datagrid. All this is done on the update section of the code. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??
Why do you need to repopulate it after you've done the update? Can you post the code? It might help. Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito Song -
Why do you need to repopulate it after you've done the update? Can you post the code? It might help. Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito SongHi Paul: So then are you suggesting that once the update is done(assuming it's carried out) this update must be carried out on the dataset also. So must i do this dddatagrid.edititemindex =-1 statement just say dddatagrid.databind() instead of dddatagrid.edititemindex =-1 objDataSourceShippedorders=objOrders.GetShippedOrders dddatagrid.datasource=objDataSourceShippedorders dddatagrid.databind() But what i don't understand is how does it affect the end result.Because to me objDataSourceShippedorders would be the more accurate result if the databse was updated.So still its hould give me the same answer. My issue looks like when i update a value in the edit mode and then press update it never quite seems to pick up that new value.Something like a postback problem on drop down boxes when we do not have if not page.ispostback clause . If a Building is Completed then why do they call it BUILDING ??
-
Hi Paul: So then are you suggesting that once the update is done(assuming it's carried out) this update must be carried out on the dataset also. So must i do this dddatagrid.edititemindex =-1 statement just say dddatagrid.databind() instead of dddatagrid.edititemindex =-1 objDataSourceShippedorders=objOrders.GetShippedOrders dddatagrid.datasource=objDataSourceShippedorders dddatagrid.databind() But what i don't understand is how does it affect the end result.Because to me objDataSourceShippedorders would be the more accurate result if the databse was updated.So still its hould give me the same answer. My issue looks like when i update a value in the edit mode and then press update it never quite seems to pick up that new value.Something like a postback problem on drop down boxes when we do not have if not page.ispostback clause . If a Building is Completed then why do they call it BUILDING ??
Pradhip wrote: So then are you suggesting Not really suggesting anything, I'm taking stabs in the dark, I haven't seen the code :-D Pradhip wrote: this update must be carried out on the dataset also. I tend to use DataAdapters and CommandBuilders a lot, so when the new data comes back, I update the DataSet and then let it do the updates (through the data adapter). Here's an idea though... when you reload the data into the dataset, do you clear it down? ie. You're not doubling up the data are you? Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito Song -
Pradhip wrote: So then are you suggesting Not really suggesting anything, I'm taking stabs in the dark, I haven't seen the code :-D Pradhip wrote: this update must be carried out on the dataset also. I tend to use DataAdapters and CommandBuilders a lot, so when the new data comes back, I update the DataSet and then let it do the updates (through the data adapter). Here's an idea though... when you reload the data into the dataset, do you clear it down? ie. You're not doubling up the data are you? Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito SongHi Paul: Well..I am actually at home and so i dont have the code with me.Infact i even tried posting the code but then it looked so meesed up i took it off.Is it okay if i send it as a word file to you.Looks better then. And counterpointing your shot.I could be doubling up the data and so probably im seeing the old data on the form.I say this because i knwo for a fact that i don't set the datasource to nothing and then reset it to the new value.So its possible. But i don't see any changes on the database either. And that's what worries me. I lost the entire day fighting this. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??
-
Hi Paul: Well..I am actually at home and so i dont have the code with me.Infact i even tried posting the code but then it looked so meesed up i took it off.Is it okay if i send it as a word file to you.Looks better then. And counterpointing your shot.I could be doubling up the data and so probably im seeing the old data on the form.I say this because i knwo for a fact that i don't set the datasource to nothing and then reset it to the new value.So its possible. But i don't see any changes on the database either. And that's what worries me. I lost the entire day fighting this. Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??
Sorry Pradhip, didn't get to this last night. If you're still struggling and want to send the code by email, feel free: pdriley@santt.com I make no guarantees, but I can take a look. Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito Song -
Hi All: I code in VB.NET I have a funny issue.I have an Datagrid with a few bound columns and also an edit column.This edit column works and i have the update and cancel buttons come up when i click on edit. Then i also have the update function written in the Code Behind Page.Thsi function works because when i tell it to writhe SQL update statement on a label it writes it out.But my challenge is on the update mode any value that i update on a column does not get reflected after i press the update column. For eg:- if i change a column from 1/1/1900 to 10/16/2000 which is princiapply the update i want to make the sql statement that runs on the database contains only the old value 1/1/1900.It is as though it's not being able to pick up the change i make in the edit mode. If some body could tell me why this is happening that would be great.Anything that i have to modify in the datagrid or something If a Building is Completed then why do they call it BUILDING ??
I'm not sure if this is the same thing, but you might want to check out how the databinding occurs when the page first loads. When I was doing this I was calling the page's DataGrid refresh method during the OnLoad event. However, this then got called when I'd updated the contents of a text box. Make sure that the initial refresh is called with a condition:
If (!IsPostBack)
{
RefreshDataGrid();
}That fixed it right away for me (although it took me an hour or so in the VS.NET debugger and a 30 minute walk to realise what I'd missed -- despite helping a friend fix the same problem a few days before). If that isn't it, then the best thing I can suggest is that if you're using VS.NET, set a breakpoint somewhere in the code and step through to see what's happening, check that the update method gets called etc. -- Paul "Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office." - David Brent, from "The Office" MS Messenger: paul@oobaloo.co.uk Sonork: 100.22446
-
Sorry Pradhip, didn't get to this last night. If you're still struggling and want to send the code by email, feel free: pdriley@santt.com I make no guarantees, but I can take a look. Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito SongHi Paul: Yes I am struggling with it and have now infact already am going to develop a new form that is st fwd until this works.And i ahve also sent you the code and codebehind page in a notepad format. If a Building is Completed then why do they call it BUILDING ??
-
Sorry Pradhip, didn't get to this last night. If you're still struggling and want to send the code by email, feel free: pdriley@santt.com I make no guarantees, but I can take a look. Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito SongHi Paul: At times can manbe any foolish than i am.It was the Damn Postback.. At i just never bothered looking at it.I am now sitting here feeling outright stupid. Paul Ingsley's suggestion was what caught me pants down.. Your time was deeply appreciated.Thanks so much Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??
-
Hi Paul: At times can manbe any foolish than i am.It was the Damn Postback.. At i just never bothered looking at it.I am now sitting here feeling outright stupid. Paul Ingsley's suggestion was what caught me pants down.. Your time was deeply appreciated.Thanks so much Regards Pradhip.S If a Building is Completed then why do they call it BUILDING ??
Glad you found it. I've been trying to find time to look, but I've had a hell of an afternoon. Now I can find something else to do this evening :) Paul We all will feed the worms and trees
So don't be shy - Queens of the Stone Age, Mosquito Song