Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Update Anomaly in DataGrid Control

Reply
Thread Tools

Update Anomaly in DataGrid Control

 
 
Mo Saghir
Guest
Posts: n/a
 
      04-23-2004
I have a problem where I am trying to update a DataGrid command in place
pretty much as outlined in the various samples in MSDN:

private void InitialGrid1_UpdateCommand(object source,
System.Web.UI.WebControls.DataGridCommandEventArgs e)

{

TextBox txtID = (TextBox)e.Item.Cells[1].Controls[0];

TextBox txtName = (TextBox)e.Item.Cells[2].Controls[0];

Label1.Text = txtID.Text + "-" + txtName.Text + "-";

InitialGrid1.EditItemIndex = -1;

BindData();

}

Whenever I try to access the TextBox.Text field, I get blank if the value
was updated by the user. However, if the value is left untouched then it is
successfully propagated to TextBox.Text field. I've been trying to debug
this for a while now but I am reaching a dead end. The MSDN samples don't
mention any additional details that may pertain to this situation.
Moreover, the data binding is done via:

....

MyConnection.Open();

SqlDataAdapter myCommand = new SqlDataAdapter("select * from UserTable",
MyConnection);



DataSet ds = new DataSet();

myCommand.Fill(ds, "UserTable");

InitialGrid1.DataSource = ds;


InitialGrid1.DataBind();

MyConnection.Close();

Any help would be appreciated as this is currenlty blocking me.


 
Reply With Quote
 
 
 
 
Scott Mitchell [MVP]
Guest
Posts: n/a
 
      04-26-2004
Mo Saghir wrote:
> I have a problem where I am trying to update a DataGrid command in place
> pretty much as outlined in the various samples in MSDN:
> [snip]
> Whenever I try to access the TextBox.Text field, I get blank if the value
> was updated by the user. However, if the value is left untouched then it is
> successfully propagated to TextBox.Text field.


Are you only binding the data to the DataGrid when it is NOT a postback,
or are you binding the data to the DataGrid on ALL page loads?

It sounds like this may be the problem... for more info, see this FAQ:

Why Your DataGrid's Updates Don't Show Up
http://datawebcontrols.com/faqs/Edit...NotSaved.shtml

Happy Programming!

--

Scott Mitchell
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.4GuysFromRolla.com
http://www.ASPFAQs.com
http://www.ASPMessageboard.com

* When you think ASP, think 4GuysFromRolla.com!
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Java control panel anomaly Roedy Green Java 2 10-24-2011 03:05 PM
TreeView control's selected property anomaly Jiho Han ASP .Net 0 10-13-2006 08:02 PM
Cisco 2650 Nat anomaly nashweber@gmail.com Cisco 0 10-13-2005 12:58 AM
Vlan Hopping Anomaly Jos_Cit Cisco 15 08-15-2005 05:35 AM
To all Gurus: How can I edit/update a DataGrid in a DataGrid (nested DataGrid)? Possible? Andreas Klemt ASP .Net Datagrid Control 0 10-08-2003 01:19 AM



Advertisments