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

[Solved] RadAjaxPanel inside User Control

11 Answers 402 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Shane
Top achievements
Rank 1
Shane asked on 03 Oct 2007, 01:29 AM
Hi Guys

Can I use RadAjaxPanel inside User Controls? I don't want to wrap the place holder with Rad Ajax Panel, because some of the user control should not use ajax.

Cheers
Shane

11 Answers, 1 is accepted

Sort by
0
Vlad
Telerik team
answered on 03 Oct 2007, 08:29 AM
Hello Shane,

There will be no problems to use RadAjaxPanel in a UserControl.

Sincerely yours,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shane
Top achievements
Rank 1
answered on 03 Oct 2007, 11:17 PM
Hi Vlad

The problem is that I have a <% %> inside the user control.

Eg:  <asp:TextBox id="txt" runat="server" text='<%=someVar%>'>

I can't use RadCodeBlock, so how do I overcome this problem? Please advise me

Cheers
Shane
0
Vlad
Telerik team
answered on 04 Oct 2007, 11:14 AM
Hello Shane,

You can use the standard PlaceHolder instead RadCodeBlock.

Greetings,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shane
Top achievements
Rank 1
answered on 08 Oct 2007, 06:07 AM
Hi Vlad

Could you please give me man example?

My Code is

<asp:panel id="pnl" runat="server"
<telerik:radajaxpanel runat="server" id="panel"
<table> 
<tr> 
                                <td> 
                                    <label>Release Date</label><br /> 
                                    <asp:TextBox ID="txtreleaseDate" onmouseover="Help(this,'Release Date','The Release Date of a discount code is the day that a discount code becomes valid for customers to use.');" 
                                        onmouseout="HelpOut(this);" runat="server" CssClass="textbox150" BackColor="#f0f0f0"></asp:TextBox><a 
                                            onclick="displayDatePicker('<%=txtreleaseDate.ClientID%>');return false;" href="#"><img height="13" alt="Select Date" 
                                                src="/CatalystImages/Popup.gif" width="13" style="border: 0" /></a></td> 
                                <td> 
                                    <label>Expiry Date</label><br /> 
                                    <asp:TextBox ID="txtExpiryDate" onmouseover="Help(this,'Expiry Date','The Expiry Date of a discount code is the day that the discount code loses validity and can\'t be used by your customers.');" 
                                        onmouseout="HelpOut(this);" runat="server" CssClass="textbox150" BackColor="#f0f0f0"></asp:TextBox><a 
                                            onclick="displayDatePicker('<%=txtExpiryDate.ClientID%>');return false;" href="#"><img height="13" alt="Select Date" 
                                                src="/CatalystImages/Popup.gif" width="13" style="border: 0" /></a></td> 
                            </tr> 
</table> 
</telerik:radajaxpanel> 
</asp:panel> 

Cheers
Shane

0
Vlad
Telerik team
answered on 08 Oct 2007, 10:56 AM
Hi Shane,

Here is an example:
            <asp:Panel ID="pnl" runat="server"
                <telerik:RadAjaxPanel runat="server" ID="panel"
                    <table> 
                        <tr> 
                            <td> 
                                <asp:PlaceHolder ID="PlaceHolder1" runat="server"
                                    <label> 
                                        Release Date</label><br /> 
                                    <asp:TextBox ID="txtreleaseDate" onmouseover="Help(this,'Release Date','The Release Date of a discount code is the day that a discount code becomes valid for customers to use.');" 
                                        onmouseout="HelpOut(this);" runat="server" CssClass="textbox150" BackColor="#f0f0f0"></asp:TextBox> 
                                    <onclick="displayDatePicker('<%=txtreleaseDate.ClientID%>');return false;" href="#"
                                        <img height="13" alt="Select Date" src="/CatalystImages/Popup.gif" width="13" style="border: 0" /></a></asp:PlaceHolder> 
                            </td> 
                            <td> 
                                <asp:PlaceHolder ID="PlaceHolder2" runat="server"
                                    <label> 
                                        Expiry Date</label><br /> 
                                    <asp:TextBox ID="txtExpiryDate" onmouseover="Help(this,'Expiry Date','The Expiry Date of a discount code is the day that the discount code loses validity and can\'t be used by your customers.');" 
                                        onmouseout="HelpOut(this);" runat="server" CssClass="textbox150" BackColor="#f0f0f0"></asp:TextBox><a 
                                            onclick="displayDatePicker('<%=txtExpiryDate.ClientID%>');return false;" href="#"><img 
                                                height="13" alt="Select Date" src="/CatalystImages/Popup.gif" width="13" style="border: 0" /></a></asp:PlaceHolder> 
                            </td> 
                        </tr> 
                    </table> 
                </telerik:RadAjaxPanel> 
            </asp:Panel> 


Best wishes,
Vlad
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shane
Top achievements
Rank 1
answered on 08 Oct 2007, 11:16 PM
Hi Vlad

It doesn't seem like an elegant way of doing things, since I have so many <% block in that page. Do you have a fix rather than a workaround? :-)

Cheers
Shane
0
Shane
Top achievements
Rank 1
answered on 09 Oct 2007, 07:39 AM
Hi Vlad

And also I have some javascript on that page as well and I need those javascript inside the ajaxpanel.

Cheers
Shane
0
Hristo Deshev
Telerik team
answered on 11 Oct 2007, 07:12 AM
Hi Shane,

I just posted a reply to the other thread where we discuss this with David. It is too darn hard to fix that and the problem haunts the smartest Telerik developers already.

I have an idea about the specific issue you are having in this thread. This code:

onclick="displayDatePicker('<%=txtExpiryDate.ClientID%>');return false;"

can be rewritten like this:
onclick="displayDatePicker(this.id);return false;"

because on* attributes already set the this variable so that it points to the current DOM element and that text box already has its client-side id property set to the server control's ClientID value. This way you eliminate the need for a server-side expression in that attribute. Try that approach and tell me if it works for you.
 

Regards,
Hristo Deshev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shane
Top achievements
Rank 1
answered on 11 Oct 2007, 07:23 AM
Hi Hristo

It won't work, because I am using an <a> and <img> tag.

I can change it to work, but I also have javascript files. There should be a way to overcome this problem.

If MS update panel can do, why can't Rad Ajax do? :-)

Cheers
Shane
0
Hristo Deshev
Telerik team
answered on 11 Oct 2007, 11:24 AM
Hello Shane,

Have you tried it? That technique should work with any attribute on a DOM element and  server controls typically render an ID attribute with a value of their ClientID.

I explained in the other thread I originally referenced that the problem comes when we generate a dynamic UpdatePanel control that does the Ajax update. The MS update panel does not have this problem because you reference it, and already add controls inside. Nothing is generated on the fly.

Regards,
Hristo Deshev
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
Shane
Top achievements
Rank 1
answered on 11 Oct 2007, 09:52 PM
Hi Hristo

I don't want to change it, because I am using it many places. And in some places I am using <% block to access viewstate, and to bind data.

I am going to stick with MS Updatepanel for now until this issue is been resolved.

Cheers
Shane
Tags
Ajax
Asked by
Shane
Top achievements
Rank 1
Answers by
Vlad
Telerik team
Shane
Top achievements
Rank 1
Hristo Deshev
Telerik team
Share this question
or