.net - DataGrid Values Not Updating After The Edit / Update Function?

Mar 24, 2011

I am using the following code to update the data in my datagrid.

But when I click update the value is updated in the database but it still shows old value in datagrid.

If I refresh the page after that then datagrid shows the updated value.

Code On Update Command:

protected void MySQLDataGrid2_UpdateCommand(object source, DataGridCommandEventArgs e)
{
string newData;
TextBox aTextBox;
aTextBox = (TextBox)(e.Item.Cells[0].Controls[0]);
newData = aTextBox.Text;
decimal comm = Convert.ToDecimal(newData);
string UpdateHiveCommission = "Update tbl_HiveCommission set Commission = '" + Convert.ToDecimal(newData) + "'";
MySqlConnection objMyCon3 = new MySqlConnection(strProvider);
objMyCon3.Open();
MySqlCommand cmd3 = new MySqlCommand(UpdateHiveCommission, objMyCon3);
cmd3.ExecuteNonQuery();
objMyCon3.Close();
MySQLDataGrid2.EditItemIndex = -1;
MySQLDataGrid2.DataBind();
}

View 3 Replies


Similar Messages:

Data Controls :: Add Edit Update Delete In DataGrid Control

Nov 15, 2013

im trying to add edit button in my gridview.  when click in that row the values will automatically filled up the textbox. Im done w/ remove button. here is my code

<asp:GridView ID="gvAddedPersonnel" runat="server" AutoGenerateColumns="False" CellPadding="2"
Style="width: 100%" onSelectedIndexChanged="gvAddedPersonnel_SelectedIndexChanged"
ShowHeaderWhenEmpty="True" onrowcreated="gvAddedPersonnel_RowCreated">
<Columns>

[code]...

How can i add the update button w/out conflicting to remove.

View 1 Replies

Forms Data Controls :: FormView Updating (again) Upon Page Refresh After Successful Edit / Update

May 21, 2010

I have a strange issue with the FormView. After working through some issues getting the update to work (as this is my first experience with FormViews) I now have a new issue. After I perform an update, and the FormView updates and returns to read mode, if I hit F5 (refresh) the FormView performs another update to the datasource, despite the fact it is read-only mode and none of the fields on the screen are editable.

I would think that a refresh in read mode for the FormView after an edit would simply refresh the data from the database, not perform another update. Again, the FormView is in Read Only Mode, but a refresh is creating another Update event (which I can debug and see if I break in the ItemUpdating event). This only happens after I perform an edit, not when the page initially loads.

View 2 Replies

Forms Data Controls :: GridView Edit Update Function?

Oct 11, 2010

I have a gridview and am using the Edit - Update function to update one field in my gridview. I have the textbox appearing as I want it and am able to update the data for that cell.

The problem I have is refreshing the gridview after the update. The Update and cancel are still shown instead of the gridview refreshing back to the Edit statement after the update.

View 4 Replies

Forms Data Controls :: Datagrid That The User Can Edit And Click A Checbox Then Input Their Initials To Update A Task?

Aug 4, 2010

I have a datagrid that the user can edit and click a checbox then input their initials to update a task. The update works except it does not record the userid field. Below is the gridview code and the vb/sql

[Code]....

View 14 Replies

AJAX :: Updatepanel Updating - Lblemail1 Do Not Update On The Page With The New Values?

May 6, 2010

I have the following code -

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always" >
<ContentTemplate>
<asp:Image ID="Image1" runat="server" ImageUrl="~/captcha.aspx" /> [code]....

Problem is the lblname1, lblphone1 and lblemail1 do not update on the page with the new values, if I step into the routine I can see the values and a success asssignments but on the page I get NO values. I removed from code the updatepanel and I get the values on page.I also tried conditional updatemode with no success but again I get NO values.

View 3 Replies

C# - How To Edit And Update Row Values In Grid View

Feb 15, 2011

I have a gridview like this :

<asp:GridView ID="gvProducts" runat="server" AutoGenerateEditButton="True" AutoGenerateColumns="False"
OnRowEditing="gvProducts_RowEditing" OnRowUpdating="gvProducts_RowUpdating" CellPadding="4"
ForeColor="#333333" GridLines="None">
<RowStyle BackColor="#FFFBD6" ForeColor="#333333" />
<Columns>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label ID="lblPID" runat="server" Text="Product ID"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblProdID" runat="server" Text='<%#Eval("ProductID")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtProdID" runat="server" Text='<%#Eval("ProductID")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>
<asp:Label ID="lblPName" runat="server" Text="Product Name"></asp:Label>
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblProdName" runat="server" Text='<%#Eval("ProductName")%>'></asp:Label>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtProdName" runat="server" Text='<%#Eval("ProductName")%>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
<FooterStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#FFCC66" ForeColor="#333333" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="Navy" />
<HeaderStyle BackColor="#990000" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>

and here is the code behind page

protected void gvProducts_RowEditing(object sender, GridViewEditEventArgs e)
{
gvProducts.EditIndex = e.NewEditIndex;
}
protected void gvProducts_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
int i = e.RowIndex;
object control = gvProducts.Rows[i].FindControl("txtProdID");
//i want to access the new value from the object "control" but i m getting the previous value only
}

View 2 Replies

Forms Data Controls :: How To Convert Datagrid To Enter The Values And Update The Database

Feb 24, 2011

I have take a datagrid view and now i want to update the records as the database is been normalized i need to enter the multiple rows at once. How you I convert the datagrid to enter the data so that it would be easy for me to update the records?

View 1 Replies

Web Forms :: Edit Update Multiple Gridview Row And Cell Values On A Single Click

May 25, 2012

Currently I have a grid view with few rows of data & edit and update for each row but I want it to be done on a single click with w external edit & save button how can the functionality be performed.

View 1 Replies

Forms Data Controls :: Formview Insert Adds All Null Values - Update Doesn't Update Values

Apr 12, 2010

I have a typical gridview/formview master control setup. When I try to update or insert I don't get any errors but it also doesn't work. When I try to insert data all I get are null values and when I update, none of the values are updated. The formview looks like its working, but just doesn't. The primary key is an identity and it auto-increments by one.

[Code]....

View 3 Replies

Forms Data Controls :: DataGrid's - Call A Server - Side Function On ItemDataBound Event Except Client - Side Function

Jan 10, 2010

I Getting A Problem In DataGrid's ItemDataBound Event. I Am Calling A JavaScript Function In DataGrid's ItemDataBound Which Retrun The CellIndex And RowIndex Number On Which UserClick After That I Am Re-Binding The DataGrid With jQuery Function After That ItemDataBound Event Not Working. I Want To Call The Same Function Again. Is Their Any Method To Call A Server-Side Function On ItemDataBound Event Except Client-Side Function..

View 4 Replies

ADO.NET :: Updating Database From Datagrid?

Nov 16, 2010

Does anyone know how i can take a row data in a datagrid and insert it into a table on my database?

I have the following code, but it doesnt seem to be working.

[Code]....

View 5 Replies

Web Forms :: GridView To Update (edit) Columns And View Table Without Edit Link?

Jan 25, 2011

I have a user requirement to hav the ability to directly edit the gridview without having to click the edit link. I was thinking of showing dropdown lists for each column-to-row so that the user can select the values for each record. Then the table will be updated accordingly (no update link).

Is this possible or do I still need the edit template and specify the item template with the dropdown list?

View 1 Replies

Web Forms :: How To Assign Values Of Data Table To A Datagrid When Datagrid Has Data List And Text Boxes

Jan 8, 2010

I had called the data from query to data table and now i have a gridview in which i am using one datalist and 2 text boxes and and reming coloumns are bounded iahve to assiaign them values which datatable have either null or any value.

View 2 Replies

Forms Data Controls :: E.values Updating Values But Not After Manipulating The String?

Nov 19, 2010

I am using Asp.net 3.5 listview control. In item_updating event I am using this code...

dim country as string = Dim country As String = e.NewValues("country_name").ToString.Replace(" ", "")

It's updating record correctly. for example if I update USA to USA 1 1 then it's updating like as it. But I want it to be USA11

View 2 Replies

Sorting - Updating DataGrid To A GridView Control

Dec 1, 2010

I have a datagrid that is displaying data that is being returned from a stored procedure. That works fine. The problem is that I want to do sorting. I know that there is sorting functionality in the grid, however, I don't want to go back to the server and get a new set of data. What I want to do is just re-sort the data that is already being displayed.

Basically, I couldn't not find an easy solution to this issue. I tried updating my dataGrid to a gridView control and even that (for my particular issue) was difficult. I wound up un-doing all the changes and just adding another grid that had just the data I wanted for the requirement. If anyone else has an issue like this I would recommend taking it out of a datagrid and writing it in jQuery. I could of written a table that had the data I wanted (and fully sortable using a plug-in mentioned below) in 15 minutes compared to the hours I spent trying to jam a square peg into a round hole.

View 2 Replies

Updating DataGrid Binded To Custom DataTable?

Mar 20, 2010

I bind custom DataTable to DataGrid through ObjectDataSource, where i use SelectMethod and UpdateMethod. SelectMethod working great, but when I try to update row it's breaking by MissingMethodException. What should i do to fix this problem?

View 1 Replies

Forms Data Controls :: How To Update Database In Datagrid By Clicking Single Update Button

Feb 21, 2011

i got a problem to update my database which i bounded to datagrid. The problem is, i want to update my database only by clicking one update button at the bottom.. when the user click it, all the fields will be updated to database.

View 3 Replies

Forms Data Controls :: Updating Checkbox In DataGrid?

Jan 22, 2010

I have checkbox in datagrid. I m getting the right data from database. As my database is oracle, I m unable to boolean. so, I m using char value to store checkbox value.I m getting the right checkbox value but when I m trying to update checkbox, its just post back but it is not storing correct value.

View 1 Replies

Datagrid In Edit Mode?

Jan 19, 2010

I have an editable datagrid. In debug mode, the page works just fine. Outside of debug mode, when I edit a row in the datagrid and click edit button page just refreshes, not debug datagrid

View 10 Replies

MVC :: Edit Action Not Updating?

May 21, 2010

I have an edit action that is not updating. The code is below. When i debug the code , i see my udated field but it doesnt seem to get saved into the database.

[Code]....

View 2 Replies

C# - .net MVC 3 - DropDownList Not Updating During Edit?

Feb 25, 2011

I have two tables - one called Contract, one called Sow. Contract has a foreign key that points to SOW. What I'd like to do is to be able to edit the Contract details and provide a drop down list of different SOW records to choose from. The current code:

In my Contract Controller:

public ActionResult Edit(int id)
{
Contract contract = contractRepository.GetContract(id); [code]...

The list populates with values, but when I change them and update, the foreign key does not change.

View 2 Replies

AJAX :: Update A DIV Without Updating The Whole Page Using Update Panel?

Jan 12, 2011

Above is my code to call a hidden DIV:

[Code]....

And above the html for the DIV:

[Code]....

on Code behind:

[Code]....

Now i was trying to use an UPDATE PANEL, in order to when i click button Save, only the DIV updates. Because the whole DIV is closing when i click on SAVE, even if i put a div in an update panel.

View 4 Replies

AJAX :: Update Panel Not Updating Even On UpdatePanel.update()

Dec 9, 2010

I am having a weird issue with the update panels. I have an update panel in UpdateMode = Conditional . I have a dropdown list and a grid view..the gridview has to be updated ÖnSelectionChanged event on the dropdown.

The issue here is on changing the selection on dropdown, the onselectionchanged event is triggered, new data is grabbed, bound to gridview..but does nt update the update panel even after the updatepanel.update();

[Code]....

View 2 Replies

How To Use Edit Button Control In Datagrid

Nov 10, 2010

i am developing asp.net application using visual studio 2003 version. I know only vb script not c# or others. my requirement is like this "from sql server database i getting some table data and displaying on the datagrid.I had customised the datagrid with button column with (Edit,Update,Cancel) Option." I stucked up here.

my requirement is by pressing Edit button one column in the datagrid should come under edit mode. After editing the data by clicking on the update button it should update the data in the database, like wise by clicking on the cancel button it should cancel the edit process etc.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved