{"action":"created","issue":{"url":"https://api.github.com/repos/hikalkan/jtable/issues/1619","labels_url":"https://api.github.com/repos/hikalkan/jtable/issues/1619/labels{/name}","comments_url":"https://api.github.com/repos/hikalkan/jtable/issues/1619/comments","events_url":"https://api.github.com/repos/hikalkan/jtable/issues/1619/events","html_url":"https://github.com/hikalkan/jtable/issues/1619","id":54812224,"number":1619,"title":"Refresh table Data","user":{"login":"oabrego","id":6922250,"avatar_url":"https://avatars.githubusercontent.com/u/6922250?v=3","gravatar_id":"","url":"https://api.github.com/users/oabrego","html_url":"https://github.com/oabrego","followers_url":"https://api.github.com/users/oabrego/followers","following_url":"https://api.github.com/users/oabrego/following{/other_user}","gists_url":"https://api.github.com/users/oabrego/gists{/gist_id}","starred_url":"https://api.github.com/users/oabrego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oabrego/subscriptions","organizations_url":"https://api.github.com/users/oabrego/orgs","repos_url":"https://api.github.com/users/oabrego/repos","events_url":"https://api.github.com/users/oabrego/events{/privacy}","received_events_url":"https://api.github.com/users/oabrego/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-01-19T21:05:24Z","updated_at":"2015-01-19T22:09:51Z","closed_at":null,"body":"Hi everyone, i hope someone could help me. I have an asp.net application with linq to sql and jtable. The problem is in the moment when insert a new record, the record is saved in the database, but it's not reflected in jtable till close the application and reopen it.\r\n\r\nI tried to clear cache, refresh the jtable, refresh the datacontext of linq to sql, but nothing.\r\n\r\nWhat can i do?.\r\nThanks."},"comment":{"url":"https://api.github.com/repos/hikalkan/jtable/issues/comments/70570239","html_url":"https://github.com/hikalkan/jtable/issues/1619#issuecomment-70570239","issue_url":"https://api.github.com/repos/hikalkan/jtable/issues/1619","id":70570239,"user":{"login":"oabrego","id":6922250,"avatar_url":"https://avatars.githubusercontent.com/u/6922250?v=3","gravatar_id":"","url":"https://api.github.com/users/oabrego","html_url":"https://github.com/oabrego","followers_url":"https://api.github.com/users/oabrego/followers","following_url":"https://api.github.com/users/oabrego/following{/other_user}","gists_url":"https://api.github.com/users/oabrego/gists{/gist_id}","starred_url":"https://api.github.com/users/oabrego/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oabrego/subscriptions","organizations_url":"https://api.github.com/users/oabrego/orgs","repos_url":"https://api.github.com/users/oabrego/repos","events_url":"https://api.github.com/users/oabrego/events{/privacy}","received_events_url":"https://api.github.com/users/oabrego/received_events","type":"User","site_admin":false},"created_at":"2015-01-19T22:09:51Z","updated_at":"2015-01-19T22:09:51Z","body":"With this code  insert in the data base,  i  have a refresh button in the jtable, and i try call the datacontext after and before insert but doesn't work till close the session and reopen it \r\n\r\nusing (CostosCotizacionesDataContext dbCotizam = new CostosCotizacionesDataContext())\r\n                {                   \r\n                    CostosCotizaciones record = new CostosCotizaciones(); //SQL\r\n                    decimal fnlftes = 0;\r\n                    if (ViewState[\"FinalFletes\"] != null)\r\n                    {\r\n                        fnlftes = (decimal)ViewState[\"FinalFletes\"];\r\n                    }\r\n                    record.no_cotizacion = c_NoCot;              \r\n                    record.version = Convert.ToInt16(N_Ver);                \r\n                    record.id_cte = Convert.ToInt32(ddlCliente.SelectedValue.ToString());                 \r\n                    record.unidadNegocio = Convert.ToInt32(ddlUnidadNegocio.SelectedValue.ToString());                  \r\n                    record.moneda = Convert.ToInt32(ddlMoneda.SelectedValue.ToString());                 \r\n                    record.tipo_cambio = Convert.ToDecimal(txtParidad.Text);               \r\n                    record.empleado_cotizo = lblTest.Text;                    \r\n                    record.empleado_vendedor = ddlVendedor.SelectedValue.ToString();                   \r\n                    record.id_contacto = Convert.ToInt32(ddlContacto.SelectedValue.ToString());                   \r\n                    record.fecha = Convert.ToDateTime(txtFecha.Text);                   \r\n                    record.id_ciudad = Convert.ToInt32(ddlUbicacion.SelectedValue.ToString());                   \r\n                    record.id_estado = GetIdState(Convert.ToInt32(ddlUbicacion.SelectedValue.ToString()));                    \r\n                    record.id_pais = GetIdPais(Convert.ToInt32(ddlUbicacion.SelectedValue.ToString()));                    \r\n                    record.proyecto = ddlProyectoPrincipal.SelectedItem.ToString();                   \r\n                    record.material = fnlftes - fnlftes;                    \r\n                    record.flete = fnlftes;                  \r\n                    record.estatus = \"COT\";                  \r\n                    record.tasaIVA = 0;                    \r\n                    record.zona = zona;                   \r\n                    record.tipo_cotizacion = C_tipo;                    \r\n                    record.imprimir_peso = chkImpPeso.Checked;                   \r\n                    record.imprimir_precio = chkImpPu.Checked;                  \r\n                    record.idioma = Convert.ToChar(rbtlIdioma.SelectedValue.ToString());                  \r\n                    if (chkAditiva.Checked == true)                    {\r\n                        record.seguimiento = Convert.ToChar(\"A\");                       \r\n                    }\r\n                    else\r\n                    {\r\n                        record.seguimiento = Convert.ToChar(\"N\");                       \r\n                    }\r\n                    record.observaciones = \"\";\r\n                    if (txtAlias.Text == string.Empty)\r\n                    {\r\n                        record.alias = \"\";                      \r\n                    }\r\n                    else\r\n                    {\r\n                        record.alias = txtAlias.Text.ToUpper();                       \r\n                    }\r\n\t\t\t\t\tcon.sp = \"sp_returntableidentity\";\r\n                    con.spParametros.Add(\"@tabla\", System.Data.SqlDbType.VarChar, 50).Value = \"costos_tm_cotizaciones\";\r\n                    con.spParametros.Add(\"@identidad\", System.Data.SqlDbType.Int, 4).Direction = System.Data.ParameterDirection.ReturnValue;\r\n                    N_IdCot = Convert.ToInt32(con.execSP(\"@identidad\").ToString());                                      \r\n                    record.id_cotizacion = N_IdCot;  //GET THE IDENTITY BEFORE INSERT\r\n\t\t\t\t\t\r\n\t\t\t\t\tMemoryDataSource mds = new MemoryDataSource(); //RELOAD ALL DATA CONTEXT IN THE APP\r\n                    mds.costoscotizaciones.Add(record);\r\n\t\t\t\t\t\r\n\t\t\t\t\tdbCotizam.costos_tm_cotizaciones.InsertOnSubmit(rec);                  \r\n                    dbCotizam.SubmitChanges(); //THE DATA IT'S INSERTED ON THE DB\r\n\t\t\t\t\t\r\n\t\t\t\t\t//TRY TO REFRESH THE DATA CONTEXT\r\n\t\t\t\t\tdbCotizam.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, dbCotizam.costos_tm_cotizaciones);\r\n                    dbCotizam.Refresh(System.Data.Linq.RefreshMode.OverwriteCurrentValues, rec);\r\n\t\t\t\t\t//CLEAR THE CACHE\r\n\t\t\t\t\tdbCotizam.GetType().InvokeMember(\"ClearCache\", System.Reflection.BindingFlags.Instance |\r\n                        System.Reflection.BindingFlags.Public |\r\n                        System.Reflection.BindingFlags.NonPublic |\r\n                        System.Reflection.BindingFlags.InvokeMethod, null, dbCotizam, null);\r\n\t\t\t\t\t\t\r\n\t}"}}