When updating from a DataGrid the canges in textboxes are not detected

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default RE: When updating from a DataGrid the canges in textboxes are not detected

    Boris,

    What's in your Page_Load? Are you databinding on each postback? If so,
    this can cause this problem. You should only databind on the intial
    request in Page_Load. All other databinding should take place in other
    places.

    Jim Cheshire
    Developer Support
    ASP.NET
    [email]jamesche@online.microsoft.com[/email]

    This post is provided as-is with no warranties and confers no rights.

    --------------------
    >From: "Boris Zakharin" <zakharin@alumni.upenn.edu>
    >Subject: When updating from a DataGrid the canges in textboxes are not
    detected
    >Date: Mon, 28 Jul 2003 13:05:52 -0400
    >Lines: 30
    >X-Priority: 3
    >X-MSMail-Priority: Normal
    >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    >Message-ID: <OHYsBqSVDHA.2364@TK2MSFTNGP09.phx.gbl>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >NNTP-Posting-Host: pcp109626pcs.wchryh01.nj.comcast.net 68.45.80.28
    >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP09.phx.gbl
    >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:162691
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >I have the following function to update data from a DataGrid
    >----------------------
    >private void DataGrid1_UpdateCommand(object source,
    >System.Web.UI.WebControls.DataGridCommandEventArg s e)
    >{
    > string key = DataGrid1.DataKeys[e.Item.ItemIndex].ToString();
    > TextBox tb;
    > dsJobs2.jobsRow r;
    > r = dsJobs21.jobs.FindByjob_id(int.Parse(key));
    > for (int i = 1; i < DataGrid1.Columns.Count-1; ++i)
    > {
    > tb = (TextBox) e.Item.Cells[i].Controls[0];
    > r.ItemArray[i] = tb.Text;
    > Response.Write(tb.Text);
    > }
    > oleDbDataAdapter1.Update(dsJobs21);
    > DataGrid1.EditItemIndex = -1;
    > DataGrid1.DataBind();
    >}
    >
    >-----------------------
    >
    >The Response.Write statement confirms that tb.Text lists the original value
    >of the textbox, not the changes I have made. What could possibly be causing
    >this?
    >
    >Thanks,
    >Boris Zakharin
    >
    >
    >
    Jim Cheshire Guest

  2. Similar Questions and Discussions

    1. TextBoxes in DataGrid/List
      Hello, I need to display & edit some data comming form the middle tier in a DataGrid or DataList control. Upon databinding, the control should...
    2. Datagrid with textboxes on itemtemplate
      Hello I have datagrid that by defect in a column of itemtemplate I place textbox. The application is of the goals of a soccer game Then it appears...
    3. ASP.NET Datagrid filling textboxes
      I am currently filling textboxes with the data from a datagrid with the following code: Sub Fillnextrecord(ByVal e As DataGridCommandEventArgs) ...
    4. Datagrid EDIT using Main form textboxes
      Hi Folks I am using datagrid to display ,delete ,edit records. I have main form on top of the page which are text boxes when they click on...
    5. Adding textboxes for filtering in DataGrid header
      Hi All, - Visual Studio 2002 - VB.NET > ASP.NET I created a DataGrid on a webform. This datagrid has sorting enabled. I want to create in the...
  3. #2

    Default Re: When updating from a DataGrid the canges in textboxes are not detected

    Thanks a lot. That was the problem.

    "Jim Cheshire (MS)" <jamesche@online.microsoft.com> wrote in message
    news:4X7qI8UVDHA.2120@cpmsftngxa06.phx.gbl...
    > Boris,
    >
    > What's in your Page_Load? Are you databinding on each postback? If so,
    > this can cause this problem. You should only databind on the intial
    > request in Page_Load. All other databinding should take place in other
    > places.
    >
    > Jim Cheshire
    > Developer Support
    > ASP.NET
    > [email]jamesche@online.microsoft.com[/email]
    >
    > This post is provided as-is with no warranties and confers no rights.

    Boris Zakharin Guest

  4. #3

    Default Re: When updating from a DataGrid the canges in textboxes are not detected

    Hi Boris,

    Glad to help.

    Jim Cheshire
    Developer Support
    ASP.NET
    [email]jamesche@online.microsoft.com[/email]

    This post is provided as-is with no warranties and confers no rights.

    --------------------
    >From: "Boris Zakharin" <zakharin@alumni.upenn.edu>
    >References: <OHYsBqSVDHA.2364@TK2MSFTNGP09.phx.gbl>
    <4X7qI8UVDHA.2120@cpmsftngxa06.phx.gbl>
    >Subject: Re: When updating from a DataGrid the canges in textboxes are not
    detected
    >Date: Mon, 28 Jul 2003 21:18:23 -0400
    >Lines: 19
    >X-Priority: 3
    >X-MSMail-Priority: Normal
    >X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
    >X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
    >Message-ID: <uBgJP9WVDHA.2012@TK2MSFTNGP10.phx.gbl>
    >Newsgroups: microsoft.public.dotnet.framework.aspnet
    >NNTP-Posting-Host: pcp109626pcs.wchryh01.nj.comcast.net 68.45.80.28
    >Path: cpmsftngxa06.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
    >Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:162825
    >X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
    >
    >Thanks a lot. That was the problem.
    >
    >"Jim Cheshire (MS)" <jamesche@online.microsoft.com> wrote in message
    >news:4X7qI8UVDHA.2120@cpmsftngxa06.phx.gbl...
    >> Boris,
    >>
    >> What's in your Page_Load? Are you databinding on each postback? If so,
    >> this can cause this problem. You should only databind on the intial
    >> request in Page_Load. All other databinding should take place in other
    >> places.
    >>
    >> Jim Cheshire
    >> Developer Support
    >> ASP.NET
    >> [email]jamesche@online.microsoft.com[/email]
    >>
    >> This post is provided as-is with no warranties and confers no rights.
    >
    >
    >
    Jim Cheshire Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139