Rad Upload with Ajax

Thread is closed for posting
4 posts, 0 answers
  1. Moustafa
    Moustafa avatar
    70 posts
    Member since:
    Jul 2008

    Posted 14 Oct 2008 Link to this post

    I'm trying to use rad upload control with ajax but it fails.

    Search the telerik support I found that according to xml request limitation I can never use ajax to upload files.

    Instead I must cancel the ajax callback and do normal postback.

    I used the following code snap to cancel the even

     

    //disable ajax in case of uploading files

     

     

    if(args.EventTarget == "<%=LinkButton_Send.UniqueID%>")

     

    {

    args.EnableAjax =

    false;

     

     

    }


    It works perfectly as I need but It damage the GUI of my components [such as a rad grid]

    this is a link for the snapshot of the damaged interface.
    http://www.4shared.com/file/66858622/cdf7e426/damage.html
    and this is the actual snapshot that must appear.
    http://www.4shared.com/file/66858614/fb912d0/actual.html

    when I removed the line that cancel the ajax it works fine and no interface damage.

    Is there any work a round for my problem.
     
    Note:
    • I'm using radcontrols for asp.net ajax 2008 Q2
    • asp.net framework 3.5
  2. Erjan Gavalji
    Admin
    Erjan Gavalji avatar
    1455 posts

    Posted 14 Oct 2008 Link to this post

    Hi Moustafa,

    The problem happens because of the EnableAjaxSkinRendering property. Please, set it to true in the method, handling the postback (e.g. the upload button click).

    Kind regards,
    Erjan Gavalji
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
  3. Moustafa
    Moustafa avatar
    70 posts
    Member since:
    Jul 2008

    Posted 14 Oct 2008 Link to this post


    thanks very much for your fast reply and good knowledge.

    yes it works fine as you tell me for the radgrid control

    but other controls have the same problem

    Is this mean I'll do the same thing for all other controls??

    Is there any solution that I can do for all controls once a time.??
  4. Lini
    Admin
    Lini avatar
    2144 posts

    Posted 16 Oct 2008 Link to this post

    Hello Moustafa,

    The EnableAjaxSkinRendering property is used to ensure that the control's CSS files are rendered on the page. By default it is set to true, but then after the control is shown on the page the value of the property is set to false, because it is assumed that, at that time the CSS files are also on the page. When you cancel the Ajax request and make a postback, the property is set to false because it is assumed that this is a normal postback and that the controls will be rendered normally on the page. However, the controls are not updated after the postback and their CSS files are not rendered. This is why you need to reset the EnableAjaxSkinRendering value to true, which will force the control's skin (css) files to be output to the page. You will need to set it for all controls that fail to render their skins automatically.

    I can offer you a small method, which will set the property for all RadControls on the page -


    public void SetAjaxSkin(Control target) 
        if (!target.Visible) 
            return
        if (target is Telerik.Web.ISkinnableControl) 
        { 
            Telerik.Web.ISkinnableControl skinnableControl = target as Telerik.Web.ISkinnableControl; 
            skinnableControl.EnableAjaxSkinRendering = true
        } 
        else 
        { 
            foreach (Control child in target.Controls) 
            { 
                SetAjaxSkin(child); 
            } 
        } 

    Simply call this method and pass the page form or a wrapper control as a parameter and it will cycle through all RadControls.


    Sincerely yours,
    Lini
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top