This is a migrated thread and some comments may be shown as answers.

After update still grid show old data

2 Answers 96 Views
Grid
This is a migrated thread and some comments may be shown as answers.
lakmal
Top achievements
Rank 2
lakmal asked on 16 Sep 2009, 05:42 PM
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 Answers, 1 is accepted

Sort by
0
Schlurk
Top achievements
Rank 2
answered on 17 Sep 2009, 01:49 PM
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(); 

0
lakmal
Top achievements
Rank 2
answered on 17 Sep 2009, 04:55 PM
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?




Tags
Grid
Asked by
lakmal
Top achievements
Rank 2
Answers by
Schlurk
Top achievements
Rank 2
lakmal
Top achievements
Rank 2
Share this question
or