PostbackTrigger in radajaxpanel

6 posts, 0 answers
  1. Diana
    Diana avatar
    20 posts
    Member since:
    Sep 2010

    Posted 06 Sep 2010 Link to this post


      protected void hyGeneratePdf_Click(object sender, EventArgs e)
            {
                LinkButton linbutton = (System.Web.UI.WebControls.LinkButton)sender;
                HttpContext context = this.Context;
                string fileName = linbutton.Text.Trim();
                string pdfFolderPath = Path.Combine(Server.MapPath("PDF/"), Session["UserName"].ToString());
                string filePath = Path.Combine(pdfFolderPath, fileName);
                string needZipFiles = filePath;
                byte[] zipFileContent = DownLoadSelectFile.createZip(context, needZipFiles, 1);
                if (zipFileContent != null)
                {
                    _downPdfFile(zipFileContent,fileName, 1);
                }
            }
    when  implementing this code there has en error:The name 'hyGeneratePdf' does not exist in the current context
    Can you help me ,where is worng?
    this is my code behind:
    <asp:Panel ID="panelPdfList" runat="server" ScrollBars="Auto" Height="304px" Width="430px"
                                                    valign="top">
                                                    <telerik:RadScriptBlock ID="rsbDownLoad" runat="server">
                                                        <script type="text/javascript">
                                                            function RequestStart(sender, args) {
                                                                if (args.get_eventTarget() == "<%=hyGeneratePdf.UniqueID %>",) {
                                                                    args.set_enableAjax(false);
                                                                }
                                                            }
                                                        </script>
                                                    </telerik:RadScriptBlock>
                                                    <telerik:RadAjaxPanel ID="rapGridView" runat="server">
                                                        <asp:GridView ID="grvPdfFileList" runat="server" AutoGenerateColumns="False" GridLines="None"
                                                            Width="400px" ShowHeader="False" OnRowDataBound="grvPdfFileList_RowDataBound">
                                                            <Columns>
                                                                <asp:TemplateField>
                                                                    <EditItemTemplate>
                                                                        <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
                                                                    </EditItemTemplate>
                                                                    <ItemTemplate>
                                                                        <asp:CheckBox ID="chkIsChecked" runat="server" OnCheckedChanged="chkIsChecked_CheckedChanged" />
                                                                    </ItemTemplate>
                                                                    <ItemStyle Font-Names="Calibri" Font-Size="11pt" HorizontalAlign="Left" Width="40px"
                                                                        Height="15px" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField>
                                                                    <EditItemTemplate>
                                                                        <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
                                                                    </EditItemTemplate>
                                                                    <ItemTemplate>
                                                                       <telerik:RadAjaxPanel ID="rapLinkButton" runat="server" ClientEvents-OnRequestStart="RequestStart">
                                                                            <asp:LinkButton ID="hyGeneratePdf" CssClass="leftnav" Style="color: Black; font-family: Calibri;"
                                                                                runat="server" Text='<%#Eval("UserName") %>' OnClick="hyGeneratePdf_Click"></asp:LinkButton>
                                                                        </telerik:RadAjaxPanel>
                                                                    </ItemTemplate>
                                                                    <ItemStyle Font-Names="Calibri" Font-Size="11pt" HorizontalAlign="Left" Width="240px"
                                                                        Height="15px" />
                                                                </asp:TemplateField>
                                                                <asp:TemplateField>
                                                                    <EditItemTemplate>
                                                                        <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
                                                                    </EditItemTemplate>
                                                                    <ItemTemplate>
                                                                        <asp:Label ID="lblGenerateTime" runat="server" Text='<%#Eval("UserPassword") %>'></asp:Label>
                                                                    </ItemTemplate>
                                                                    <ItemStyle Font-Names="Calibri" Font-Size="11pt" HorizontalAlign="Left" Width="130px"
                                                                        Height="15px" />
                                                                </asp:TemplateField>
                                                            </Columns>
                                                            <HeaderStyle Height="0px" />
                                                            <RowStyle Height="10px" />
                                                        </asp:GridView>
                                                    </telerik:RadAjaxPanel>
                                                </asp:Panel>
  2. Diana
    Diana avatar
    20 posts
    Member since:
    Sep 2010

    Posted 07 Sep 2010 Link to this post

    Please help me .Thank you !
  3. Iana Tsolova
    Admin
    Iana Tsolova avatar
    3388 posts

    Posted 07 Sep 2010 Link to this post

    Hello Diana,

    The error you receive is rather expected as the 'hyGeneratePdf' LinkButton is not public for the page. Try modifying the OnRequestStart event handler as below and let me know if it works for you:

    <telerik:RadScriptBlock ID="rsbDownLoad" runat="server">
    <script type="text/javascript">
    function RequestStart(sender, args) {
        if (args.get_eventTarget().indexOf("hyGeneratePdf") != -1) {
            args.set_enableAjax(false);
        }
    }
    </script>
    </telerik:RadScriptBlock>


    Greetings,
    Iana
    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
  4. Diana
    Diana avatar
    20 posts
    Member since:
    Sep 2010

    Posted 07 Sep 2010 Link to this post

    when I click one button and the RadAjaxLoadingPanel show .But at last RadAjaxLoadingPanel not hidden
    I write the following code but it also not hidden
     <telerik:RadScriptBlock ID="rsbDownLoad" runat="server">
                                                        <script type="text/javascript">
                                                            function conditionalPostback(sender, args) {
                                                                if (args.get_eventTarget() == "<%=btnDownload.UniqueID %>") {
                                                                    args.set_enableAjax(false);
                                                                }
                                                            }
                                                            function endPostback(sender, args) {
                                                                args.set_enableAjax(true);
                                                            }
                                                        </script>
                                                    </telerik:RadScriptBlock>
     <telerik:RadAjaxPanel ID="rapDownload" runat="server" ClientEvents-OnRequestStart="conditionalPostback"
                                                    ClientEvents-OnResponseEnd="endPostback">
  5. Diana
    Diana avatar
    20 posts
    Member since:
    Sep 2010

    Posted 07 Sep 2010 Link to this post

     function endPostback(sender, args) {
                                                                args.set_enableAjax(true);
                                                            }
    It is not correct that I passed this way to hide it
  6. Diana
    Diana avatar
    20 posts
    Member since:
    Sep 2010

    Posted 07 Sep 2010 Link to this post

    Thank you very much to help me solve these problems.These are useful to me.Thank you very very very much.
Back to Top