Hi All
I have a web form that uses an object class to populate a standard table (not datagrid etc)
I have a button on this form that when clicked opens another form for editing. In this form all the values of the object are used to populate text boxes (in the load event of the form there is a call to a DBHelper class which uses a SQL Parameter Array to execute a strored procedure (SQL) and return the data) and text areas which are free to edit in this form.
Also on this page I have a button called save changes which when clicked I am attempting to create a new paramater array to execute an update procedure again using the DBHelper Class.
Unfortunately when I try to do this the values in the new SQLParamater Array are exactly the same as before and are not reflecting the changes that I make by typing new entries into the text boxes on the form. As a newbie to .net I am lost here and realise that this is probably a scope or state problem but I would like someone to point me in the right direction please. When I hard wire the new SQLParamater Array the update does work so that eliminates the chances of the DBHelper Class from any fault.
Please help as I am going bonkers here!!!!!
Phill
You probably have your "populate form" bit in your Page Load function - which will execute when the save button causes a post back.
Surround your "populate the textboxes" code with:
if (!IsPostBack)
{
...
}
This will mean it only runs when the page is first loaded.
Have you looked if your sql update statement is passing the values as @.new_value
I would recommend doing this on a datagrid, it would be easier to update cuz the datagrid already has an update command field!
I cant use a datagrid as the recordset only ever returns one row with 17 fields. Datagrids need multirows to work dont they?
Datagrids work with "a number" of rows - that can be one row.
welshpunk:
I cant use a datagrid as the recordset only ever returns one row with 17 fields. Datagrids need multirows to work dont they?
Hi welshpunk,
Try to follow those codes as follows:
Working with a Single Table
http://msdn2.microsoft.com/en-us/library/aa719548(VS.71).aspx
Thanks.
Yes but you cannot turn a datagrid on its side. I have 17 fields in the recordset(just one row) Using a datagrid in this fashion is not user friendly as some of the fields are up to 2000 chars long. Datagrids will display like this
Column Heading Column Heading Column Heading Column Heading Column Heading
Data Data Data Data Data
I want to display the data in a more user friendly way like this
Column Header Data
Column Header Data
Column Header Data
Column Header Data
Column Header Data
Column Header Data
Column Header Data
With the 17 column headers on the left and their respective data adjacent to them. This is why I had to create the form in this way.
Hi,
You can write each cell every time by reading each cell once.
Hope this helps.
I have already marked as answer
Don't worry - you'll soon see that comment about marking posts as the answer absolutely everywhere!
You could try using a detailsview. The data would be displayed the way you want.
0 comments:
Post a Comment