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

9 posts, 0 answers
  1. Priya
    Priya avatar
    144 posts
    Member since:
    Jul 2008

    Posted 25 Sep 2008 Link to this post

    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

  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 25 Sep 2008 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Priya
    Priya avatar
    144 posts
    Member since:
    Jul 2008

    Posted 25 Sep 2008 Link to this post

    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

  5. Priya
    Priya avatar
    144 posts
    Member since:
    Jul 2008

    Posted 26 Sep 2008 Link to this post

    plz help me..
  6. Serrin
    Serrin avatar
    286 posts
    Member since:
    Sep 2008

    Posted 26 Sep 2008 Link to this post

    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?
  7. Priya
    Priya avatar
    144 posts
    Member since:
    Jul 2008

    Posted 27 Sep 2008 Link to this post

    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

  8. Priya
    Priya avatar
    144 posts
    Member since:
    Jul 2008

    Posted 27 Sep 2008 Link to this post

    It worked without using radajaxmanager.

    But when i use radajaxmanager,the 

    ScriptManager.RegisterStartupScript(imgbtnSearch,

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

  9. ayh
    ayh avatar
    5 posts
    Member since:
    Oct 2008

    Posted 18 Nov 2008 Link to this post

    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?
  10. Svetlina Anati
    Admin
    Svetlina Anati avatar
    2795 posts

    Posted 18 Nov 2008 Link to this post

    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.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017