I have a Page, say Page1.aspx.In it a radGrid and link button is placed
When I click on the linkbutton, a radwindow with a usercontrol is loaded.
ie,
in Page1.aspx
function
openRadWindowCustomSearch()
{
var oWnd = radopen("Custom_Search_Page.aspx", "RadWindow2" );
oWnd.setSize(700,550)
oWnd.center();
}
Inside Custom_Search_Page.aspx ,I placed a usercontrol ie,in Custom_Search_Page.aspx
<
form id="form1" runat="server">
<div>
<uc1:CustomSearch id="uclCustomSearch" runat="server" />
</div>
</form>
That usercontrol contains a button
While clicking on tht button I want to rabind the grid in Page1
Thanks in advance
15 Answers, 1 is accepted

You can click with a javascript over the button which rebinds the RadGrid,e.g.
PAGE1.ASPX
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %> |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml"> |
<head id="Head1" runat="server"> |
<title>Untitled Page</title> |
</head> |
<body> |
<form id="form1" runat="server"> |
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> |
<div> |
<telerik:RadWindowManager ID="RadWindowManager1" runat="server"> |
<Windows> |
<telerik:RadWindow ID="RadWindow1" runat="server" NavigateUrl="ContentPage.aspx" |
VisibleOnPageLoad="true" |
></telerik:RadWindow> |
</Windows> |
</telerik:RadWindowManager> |
<asp:Button ID="btnRebindGrid" runat="server" Text="RebindGrid" style="display:none" /> |
<telerik:RadGrid ID="RadGrid1" runat="server"></telerik:RadGrid> |
</div> |
</form> |
</body> |
</html> |
PAGE1.ASPX.CS
protected void Page_Load(object sender, EventArgs e) |
{ |
string[] newData = {"a","b","c" + System.DateTime.Now.ToString()}; |
RadGrid1.DataSource = newData; |
RadGrid1.DataBind(); |
} |
CONTENTPAGE.ASPX
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
<html xmlns="http://www.w3.org/1999/xhtml" > |
<head runat="server"> |
<title>Untitled Page</title> |
<script type="text/javascript"> |
function RebindGrid() |
{ |
var parentWindow = window.parent; |
parentWindow.$get("btnRebindGrid").click(); |
} |
</script> |
</head> |
<body> |
<form id="form1" runat="server"> |
<div> |
<input type="button" id="myControl" value="RebindGrid" onclick="RebindGrid()" /> |
</div> |
</form> |
</body> |
</html> |
Hope this helps!

Sir
But the content page is a usercontrol and this usercontrol is placed in another aspx file ie,Custom_Search_Page.aspx
So
when i use
var parentWindow = window.parent;
I wil get only Custom_Search_Page.aspx
And the grid is on Page1.aspx
You can try with
top.$get("btnRebindGrid").click();
this way you will get a reference to the topmost page which in your scenario is the page from which you have called RadWindow and where the grid is.
Regards,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

I m gettg the javascript error
'top.$get(..)is null or not an object when i write it in code behind of usercontrol
ie,
Usercontrol.ascx.vb
Protected
Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
Dim ds As New DataSet()
ds = Custom_SearchBAL.GridDataSource
Dim strFilterExp As String
Dim i As Integer
For i = 0 To ds.Tables(0).Rows.Count - 1
Custom_SearchBAL.SelectedFieldDatatype = ds.Tables(0).Rows(i)(
"Datatype")
strFilterExp = strFilterExp + ds.Tables(0).Rows(i)(
"ANDOR") + ds.Tables(0).Rows(i)("FilterExp")
Next
Custom_SearchBAL.ResultantFilterExp = strFilterExp
Dim strScript As String
strScript =
"<script language=javascript>"
strScript +=
"top.$get('btnRebindGrid').click();"
strScript +=
"<"
strScript +=
"/script>"
Page.RegisterStartupScript(
"MSGE", strScript)
Page1.aspx<asp:Button ID="btnRebindGrid" runat="server" Text="RebindGrid" style="display:none" />
Page1.aspx.vbProtected Sub btnRebindGrid_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRebindGrid.Click
WorkDetailsGrid.Rebind()
End Sub

This thread is getting quite long and since we are still unable to provide you with solution, I would like to ask you to open a support ticket and to send us a full, working project where the problem can be reproduced. We will check it and get back to you with a solution.
All the best,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

I created a simple project and applied ur code ther and is working fine
So I thk my prj's prbm is due postback or any other operatn on the ascx.Is ther any possibility for tht.
I m really confused
Thanks alot for ur reply
I don't see how a user control would affect that behavior, but unfortunately without a reproduction sample, I cannot tell what the problem is. If you manage to isolate the problem, please send it to me and I will check it right away.
Kind regards,
Georgi Tunev
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

The page1.aspx is a contentpage ie,masterpage is included in my prj.Is ther is a chance for my error due to it

its the prbm .Any way to solve it


i have same problem like you, i think you are closer than me solving the problem, my mail ayhantay@yahoo.com would you send me your code about the problem plz?
I assume that most probably the problem comes from the fact that both the MasterPage and the User Control are INaming Containers - this means that they change the IDs of the controls they contain. This is general ASP.NET knowledge and you can reproduce the issue by using a standard control, e.g asp button instead of RadControl - you will get the same behavior and the button will not be found. However, if you cannot manage to solve the problem yourself, prepare a sample, fully runnable demo (with DB, if needed, e.g use Northwind), open a new support ticket and send it us along with detailed reproduction steps and explanations of the actual and the desired behavior.
Best wishes,
Svetlina
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.

- The master page is just a blank master page with a contentplaceholder.
(Priya - Check your source code of the rendered name of the button and get that)
- in IE and FF it will close and update the grid the first time... after that it craps out.
- having the grid or button nested in ajaxpanel does not make a difference with either browser.
I am hoping somone could allude to :
- Why the js craps out after pressing the contentpage button
- How I would get a server event to run when clicking serverbtn on clientpage. and then close radwindw, update relevant grid
Page1.aspx
<asp:ScriptManager ID="sm1" runat="server" /> |
<telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server" |
Height="200px" width="300px"> |
<asp:Button id="GridButton" runat="server" Text="GridButton" /> <br /> |
<uc1:gridpage ID="Gridpage1" runat="server" /> |
</telerik:RadAjaxPanel> |
Page1.vb
Protected Sub GridButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridButton.Click |
Gridpage1.DataBind() |
End Sub |
Gridpage.ascx
<telerik:RadWindowManager Width="100px" Height="100px" ID="RadWindowManager1" runat="server" Behavior="Default" InitialBehavior="None" Left="" Top=""> |
</telerik:RadWindowManager> |
<script type="text/javascript"> |
function openRadWindow(ApplicationID) |
{ |
var oWnd = window.radopen("contentpage.aspx?ApplicationID=" +ApplicationID, "RadWindow2" ); |
oWnd.center(); |
} |
</script> |
<telerik:RadGrid ID="RadGrid1" runat="server"> |
<MasterTableView> |
<Columns> |
<telerik:GridTemplateColumn> |
<ItemTemplate> |
<a href="#" onclick="openRadWindow('<%# Container.DataItem %>'); return false;">Cancel</a> |
</ItemTemplate> |
</telerik:GridTemplateColumn> |
</Columns> |
</MasterTableView> |
</telerik:RadGrid> |
Gridpage.vb
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load |
Dim str As String() = {"a", "b", "c", Date.Now.ToString()} |
RadGrid1.DataSource = str |
RadGrid1.Rebind() |
End Sub |
contentpage.aspx
<script type="text/javascript"> |
function RebindGrid() |
{ |
var parentWindow = window.parent; |
parentWindow.$get("ctl00_ContentPlaceHolder1_GridButton").click(); |
} |
</script> |
<asp:Button ID="btn" runat="server" Text="serverbtn" OnClientClick="RebindGrid();" /> |
ContentPage.vb
Protected Sub btn_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btn.Click |
'Run Some code.. but it won't because the page keeps closing before the event |
createcancel() |
End Sub |
thank you very much for any assistance.
mac
Hi Mac,
I am afraid that the scenario is too complex to completely understand it only based on separate pieces of code. However we have an online demo which is very similar to your scenario - you can find it here. When you install RadControls, our online examples projects are automatically installed on your computer and you can not only examine their full source code, but also extend them further in order to meet your requirements.
You can open the demos from here:
Start\Programs\Telerik\RadControls for ASPNET AJAX\Open Sample WebSite In VisualStudio
The actual location on your hard disk is the following one:
C:\Program Files\Telerik\RadControls for ASPNET AJAX \Live Demos
In case examining the full source does not help, please open a new support ticket and send me a sample, fully runnable reproduction demo (including DB or fake datasource, e.g. XML file, if needed) along with detailed reproduction instructions and explanation of the desired behavior. Once I receiev it, I will do my best to modify it in porder to meet your requirements.
All the best,
the Telerik team
Check out Telerik Trainer, the state of the art learning tool for Telerik products.