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

pop window open new separete file,now i am insert new record that is not added in grtid but added in datatbase,same as update and delete..

1 Answer 60 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kannadasan
Top achievements
Rank 1
Kannadasan asked on 02 Aug 2010, 03:35 PM
pop window open new separete file,now i am insert new record that is not added in grtid but added in datatbase,same as update and delete..give me good  solution..i follow u r sample..

With regards
S.Kannadasan

1 Answer, 1 is accepted

Sort by
0
Mira
Telerik team
answered on 05 Aug 2010, 10:55 AM
Hello Kannadasan,

I assume that the cause of the issue is that the grid is not rebound after a new record is inserted in the database. In our demo this is done with the following code:
EditForm ASPX
function CloseAndRebind(args) {
    GetRadWindow().BrowserWindow.refreshGrid(args);
    GetRadWindow().close();
}
Default ASPX
function refreshGrid(arg)
{
 if(!arg)
 {
 $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("Rebind");           
    }
    else
    {
 $find("<%= RadAjaxManager1.ClientID %>").ajaxRequest("RebindAndNavigate");           
    }
}
Default - code behind
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
    if (e.Argument == "Rebind")
    {
        RadGrid1.MasterTableView.SortExpressions.Clear();
        RadGrid1.MasterTableView.GroupByExpressions.Clear();
        RadGrid1.Rebind();
    }
    else if (e.Argument == "RebindAndNavigate")
    {
        RadGrid1.MasterTableView.SortExpressions.Clear();
        RadGrid1.MasterTableView.GroupByExpressions.Clear();
        RadGrid1.MasterTableView.CurrentPageIndex = RadGrid1.MasterTableView.PageCount - 1;
        RadGrid1.Rebind();
    }
}
EditForm - code behind
protected void DetailsView1_ItemCommand(object sender, DetailsViewCommandEventArgs e)
{
    if (e.CommandName == "Update")
    {
        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind();", true);
    }
    else if (e.CommandName == "Insert")
    {
        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CloseAndRebind('navigateToInserted');", true);
    }
    else
    {
        ClientScript.RegisterStartupScript(Page.GetType(), "mykey", "CancelEdit();", true);
    }
}

I hope this helps.

Sincerely yours,
Mira
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
Grid
Asked by
Kannadasan
Top achievements
Rank 1
Answers by
Mira
Telerik team
Share this question
or