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

PostbackTrigger in radajaxpanel

5 Answers 199 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Diana
Top achievements
Rank 1
Diana asked on 07 Sep 2010, 04:01 AM

  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>

5 Answers, 1 is accepted

Sort by
0
Diana
Top achievements
Rank 1
answered on 07 Sep 2010, 07:07 AM
Please help me .Thank you !
0
Iana Tsolova
Telerik team
answered on 07 Sep 2010, 10:05 AM
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
0
Diana
Top achievements
Rank 1
answered on 07 Sep 2010, 10:14 AM
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">
0
Diana
Top achievements
Rank 1
answered on 07 Sep 2010, 10:17 AM
 function endPostback(sender, args) {
                                                            args.set_enableAjax(true);
                                                        }
It is not correct that I passed this way to hide it
0
Diana
Top achievements
Rank 1
answered on 07 Sep 2010, 10:25 AM
Thank you very much to help me solve these problems.These are useful to me.Thank you very very very much.
Tags
Ajax
Asked by
Diana
Top achievements
Rank 1
Answers by
Diana
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or