After update still grid show old data

3 posts, 0 answers
  1. lakmal
    lakmal avatar
    76 posts
    Member since:
    Jun 2009

    Posted 16 Sep 2009 Link to this post

    Hi,

    I use linqdatasource to show data in grid

      <asp:LinqDataSource ID="ldsDocument" runat="server" ContextTypeName="DataClassesDataContext"
                                            TableName="qry_Data_Docs" AutoPage="False">
                                                  </asp:LinqDataSource>
                                                 
    I update data using popup window. After update grid show only old data. When i refresh page its show only old data. But database has updated data. Why that?

    lakmal



  2. Schlurk
    Schlurk avatar
    812 posts
    Member since:
    May 2009

    Posted 17 Sep 2009 Link to this post

    It seems like you are updating the datasource but the grid isn't grabbing the new data. Have you tried to Rebind()?
    RadGrid1.MasterTableView.Rebind(); 

  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. lakmal
    lakmal avatar
    76 posts
    Member since:
    Jun 2009

    Posted 17 Sep 2009 Link to this post

    Hi

    This is my code for add new record. Still its not working

     <asp:LinqDataSource ID="ldsDocument" runat="server" ContextTypeName="DataClassesDataContext"
                              TableName="qry_Data_Docs" AutoPage="False"
            OrderBy="DocID desc"
            Select="new (DocID, DocNo, CTRID, PackageID, SystemID, RepCTRID, PhaseID, Document_Title, CatClassID, Client_Doc_No, DocOwnerID, LiveDataID, Comments, ClientSys_SubSysCodeID, Client_DocTypeID, ClientDiscCodeID, SubmitID, New_Document, IDCAppID, Hours, CTR_WEIGHTING, DocuStartP, DocuStartF, ReturnFromIDCF, ReturnFromIDCP, DurationIDC, SubmitForIDCA, SubmitForIDCF, SubmitForIDCP, DurationIFC, IssueForCommentsA, IssueForCommentsF, IssueForCommentsP, TransferIDC, ReturnFromIDCA, ReceiveForCommentsF, ReceiveForCommentsP, TransferCRC, ClientReturnedCommentsA, ClientReturnedCommentsF, ClientReturnedCommentsP, TransferINC, IncorporateCommentsA, IncorporateCommentsF, IncorporateCommentsP, DurationRFC, ReceiveForCommentsA, ClientReturnFromIFAF, ClientReturnFromIFAP, DurationIFA, IssueForApprovalA, IssueForApprovalF, IssueForApprovalP, DurationRFC2, ReceiveForComments2A, ReceiveForComments2F, TransferIFA, ClientReturnFromIFAA, ReceiveForComments2P, IssueForAFCF, IssueForAFCP, IncorporateComments2A, IncorporateComments2F, IncorporateComments2P, TransferCAMINC2, OURACTION, ReceiveAFCA, ReceiveAFCF, ReceiveAFCP, DurationAFC, IssueForAFCA, ClientDocType, ClientDisciplineCode, CategoryClass, Progress, SC_ACTION, CLIENTACTION, Submitable, Rep_CTR_Title, Rep_CTR_Number, CTR_Title, CTR_Number, ClientSys_SubSysCode, Phase, DocOwner, DocApprover, Live_Data, System, Package, TransferST, DocuEndA, DocuEndF, DurationST, DocuStartA, DocuEndP)">
                                                  </asp:LinqDataSource>
                                                  
                                                 
     DbConnection Con = new DbConnection();
            SqlConnection Conn = new SqlConnection();
            Conn = Con.SQLConnection();
            Conn.Open();

            TextBox txtDocTitle = (TextBox)e.Item.FindControl("txtDocTitle");
            TextBox txtClientDocNo = (TextBox)e.Item.FindControl("txtClientDocNo");
            TextBox txtDocNo = (TextBox)e.Item.FindControl("txtDocNo");

            string sqlStr = "Insert into   tbl_DATA_Docs (DocNo, [Document Title],[Client Doc No]) values('" + txtDocNo.Text + "','" + txtDocTitle.Text + "','" + txtClientDocNo.Text + "')";
            SqlCommand cmd = new SqlCommand(sqlStr, Conn);
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            Conn.Dispose();
            RadGrid4.MasterTableView.Items[1].Edit = false;
            RadGrid4.MasterTableView.Rebind();
            RadGrid4.Rebind();

    When i add new record , record is gone to database. But i cant see new record in grid. after 6 hour i can see newly added records

    Why that?




Back to Top