473,406 Members | 2,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

DataGrid Update Doesn't Show Immediately

Hi,

I'm using Matrix Web for ASP.NET. I have a datagrid which I am using
with the edit feature. When I click the OK button, the database gets
updated. This part works. However, when the page loads up, the
datagrid displays the old data. If I refresh the page, or go to edit
another item, the changed data appears. What am I doing wrong?

Here is my updater function.

--
void Languages_Update(object sender, DataGridCommandEventArgs e) {
SqlConnection conn = new SqlConnection("Data Source=WICKWACK; User
Id=XXX; Password=XXX; Database=chorallibrary");
conn.Open();

SqlCommand updateCmd = new SqlCommand("usp_UpdateLanguages",conn);
updateCmd.CommandType = CommandType.StoredProcedure;

SqlParameter myParam =
updateCmd.Parameters.Add("@RowCount",SqlDbType.Int );
myParam.Direction = ParameterDirection.ReturnValue;

myParam = updateCmd.Parameters.Add("@LanguageId",SqlDbType.I nt,0);
myParam.Value = DataGrid_Languages.DataKeys[e.Item.ItemIndex];

myParam =
updateCmd.Parameters.Add("@LanguageName",SqlDbType .NVarChar,50);
myParam.Value = ((TextBox)(e.Item.Cells[0].Controls[0])).Text;

updateCmd.ExecuteNonQuery();
conn.Close();

Int32 rowCount = (Int32) updateCmd.Parameters["@RowCount"].Value;

Message.Text = "You successfully updated "+rowCount+" rows.";

DataGrid_Languages.EditItemIndex=-1;
DataGrid_Languages.DataBind();
}

Nov 17 '05 #1
0 1172

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: Pam Ammond | last post by:
After clicking btnDeleteSize_Click in frmSize, I move to frmSizeDelete, allow deleting a Size using a datagrid, and then return to frmSize and want to update the datagrid in frmSize to reflect the...
2
by: sianan | last post by:
I have a DataGrid which displays data from a table in a MS SQL 2000 database. My problem is that I have a bit column in the database whose values I want to display as checkboxes in the DataGrid. I...
0
by: rn5a | last post by:
Suppose I have the following DataGrid: <asp:DataGrid ID="dgUsers" OnUpdateCommand="UpdateDG" runat="server"> <Columns> <TemplateColumn HeaderText="NAME"> <ItemTemplate> <asp:Label...
13
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever...
9
by: rn5a | last post by:
A DataGrid is populated with the records existing in a database. Each of the row in this DataGrid has a ButtonColumn. Assume that the DataGrid displays 10 records (i.e. 10 DataGridItems/rows). Each...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.