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

rebind grid in the content page on clicking a button on a usercontrol on the radwindow

8 Answers 108 Views
Window
This is a migrated thread and some comments may be shown as answers.
Priya
Top achievements
Rank 1
Priya asked on 25 Sep 2008, 09:17 AM
sir,
rebind grid in the content page on clicking a button on a usercontrol on the radwindow

Protected Sub imgbtnSearch_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles imgbtnSearch.Click

Dim strScript As String

strScript =

"<script language=javascript>"

strScript +=

"top.$get('btnRebindGrid').click();"

strScript +=

"<"

strScript +=

"/script>"

Page.RegisterStartupScript(

"MSGE", strScript)

End Sub

Its working for a normal page.bt wen i include master page its not workg

8 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 25 Sep 2008, 10:32 AM
Hi Priya,

If btnRebindGrid is in an user control, its ID will be changed when the control is rendered on the page. It is better to use the ClientID of the button - $get('<%= btnRebindGrid.ClientID %>')

All the best,
Georgi Tunev
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Priya
Top achievements
Rank 1
answered on 25 Sep 2008, 10:52 AM
Sir,

I have a Page, say Page1.aspx which is a content page ie,master page is included
.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.vb

Protected Sub lnkFilter_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles lnkFilter.Click

Dim newWindow As Telerik.Web.UI.RadWindow = New Telerik.Web.UI.RadWindow

newWindow.ID =

"RadWindow3"

newWindow.NavigateUrl = "Custom_Search_Page.aspx"

newWindow.VisibleOnPageLoad = True

newWindow.ReloadOnShow = True

end sub

Inside Custom_Search_Page.aspx ,I placed a usercontrol ie,

in
 Custom_Search_Page.aspx

Inside 

<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 rebind the grid in Page1
 
 I tried with
top.$get("btnRebindGrid").click(); 
 I m gettg the javascript error
'top.$get(..)is null or not an object when i write it in code behind of usercontrol and i found tht this error is due to masterpage inclusion..
ie,
Usercontrol.ascx.vb

Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click

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.vb

Protected Sub btnRebindGrid_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnRebindGrid.Click

WorkDetailsGrid.Rebind()

End Sub

Hw to use this code to
top.$get("btnRebindGrid").click();  refer a content page control

Thanks alot

0
Priya
Top achievements
Rank 1
answered on 26 Sep 2008, 07:14 AM
plz help me..
0
Serrin
Top achievements
Rank 1
answered on 26 Sep 2008, 12:58 PM
Hey Priya,

I notice that in your code you have:

top.$get('btnRebindGrid').click();

But in Georgi's solution it says:

 $get('<%= btnRebindGrid.ClientID %>')

If you modify it to read like what Georgi said, does that make it work?
0
Priya
Top achievements
Rank 1
answered on 27 Sep 2008, 05:48 AM
But using ClientId its not wrking.ie,

<

script type="text/javascript">

function RebindGrid()

{

top.$get(

'<%=btnRebindGrid.ClientID %>').click();

}

</script>

<

asp:Button runat="server" Text="Click" OnClientClick="RebindGrid" />


It gives a error
Error 24 Name 'btnRebindGrid' is not declared

when I gave the actual id got frm IE->View source.Its wrking.But its only on button client side click
ie,

<%

@ Control Language="VB" AutoEventWireup="false" CodeFile="ab.ascx.vb" Inherits="ab" %>

<script type="text/javascript">

function RebindGrid()

{

top.$get(

'ctl00$ContentPlaceHolder1$btnRebindGrid').click();

}

</script>

<

asp:Button runat="server" Text="Click" OnClientClick="RebindGrid" />

On codebehind its not wrking

0
Priya
Top achievements
Rank 1
answered on 27 Sep 2008, 08:28 AM
It worked without using radajaxmanager.

But when i use radajaxmanager,the 

ScriptManager.RegisterStartupScript(imgbtnSearch,

Me.GetType(), "MSGE", strScript, False)
 is not working

0
ayh
Top achievements
Rank 1
answered on 18 Nov 2008, 12:18 PM
hi priya
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?
0
Svetlina Anati
Telerik team
answered on 18 Nov 2008, 01:05 PM
Hello guys,

I already answered your other thread and for your convenience I pasted my reply below:

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. 

Greetings,
Svetlina
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Window
Asked by
Priya
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Priya
Top achievements
Rank 1
Serrin
Top achievements
Rank 1
ayh
Top achievements
Rank 1
Svetlina Anati
Telerik team
Share this question
or