Popup window changes doesn't update in parent grid

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

    Posted 18 Sep 2009 Link to this post

    HI,

    I have grid with tabstrip. Url is
    http://seeds-lanka.com/minute/document.aspx

    I updating data using popup window. When i edit popup window data, it doesnt change my parent grid data. Here is my code

    Popup Window code
    <SCRIPT LANGUAGE="JavaScript">
             function closeWindow() {
            
                var oWindow = GetRadWindow();
                    oWindow.OnClientClose = CloseAndRebind;
             }
             
             function GetRadWindow()
                {
                    var oWindow = null;
                    if (window.radWindow) oWindow = window.radWindow; //Will work in Moz in all cases, including clasic dialog
                    else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;//IE (and Moz as well)
                      
                    return oWindow;
                }
        
        
             
             function CloseWnd(args)
                {
               
                    GetRadWindow().close();
                    GetRadWindow().BrowserWindow.refreshGrid(args);
                }

            </SCRIPT>
     protected void cmdUpdateInfo_Click(object sender, EventArgs e)
        {
            string DocNo="";
            if (Request.QueryString["DocNo"] != null)
            {
                DocNo = Request.QueryString["DocNo"].ToString();

                DbConnection Con = new DbConnection();
                SqlConnection Conn = new SqlConnection();
                Conn = Con.SQLConnection();
                Conn.Open();
                string sqlStr = "update  tbl_DATA_Docs set [Document Title]='" + txtDocTitle.Text + "',[Client Doc No]= '" + txtClientDocNo.Text + "', SystemID= " + ddlSystem.SelectedValue + ", PackageID=" + ddlPackage.SelectedValue + ", PhaseID=" + ddlPhase.SelectedValue + ", CTRID= " + RadCTR.SelectedValue + " where DocNo= '" + DocNo + "'";
                SqlCommand cmd = new SqlCommand(sqlStr, Conn);
                cmd.ExecuteNonQuery();
                ltInfo.Text = "<SPAN style='color=blue'><br>Succesfully Updated<br></SPAN>";
                cmd.Dispose();
                Conn.Dispose();

            }
            ScriptManager.RegisterStartupScript(this, GetType(), "closeWnd", "CloseWnd('RebindAndNavigate');", true);

            }



    Main window with parent gird code

     protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
        {

            if (e.Argument == "Rebind")
            {
                RadGrid4.MasterTableView.SortExpressions.Clear();
                RadGrid4.MasterTableView.GroupByExpressions.Clear();
                RadGrid4.MasterTableView.Rebind();
                RadGrid4.Rebind();
            }
            else if (e.Argument == "RebindAndNavigate")
            {
                RadGrid4.MasterTableView.SortExpressions.Clear();
                RadGrid4.MasterTableView.GroupByExpressions.Clear();
               // RadGrid4.MasterTableView.Rebind();
                ldsDocument.DataBind();
                RadGrid4.Rebind();
              
               

                //RadGrid4.MasterTableView.SortExpressions.Clear();
                //RadGrid4.MasterTableView.GroupByExpressions.Clear();
                //RadGrid4.MasterTableView.CurrentPageIndex = RadGrid4.MasterTableView.PageCount - 1;
                //RadGrid4.Rebind();
            }


        }

    I suing linqdatasource to bind data. Other thing is when bind data to parent grid current tabstrip should open.

    lakmal







  2. lakmal
    lakmal avatar
    76 posts
    Member since:
    Jun 2009

    Posted 20 Sep 2009 Link to this post

    Hi,

    I have found solution. Have to keep ajaxmanger as update control
     <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                        <UpdatedControls>
                            <telerik:AjaxUpdatedControl ControlID="RadGrid4" />
                        </UpdatedControls>
                    </telerik:AjaxSetting>




  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top