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

Rad Upload with Ajax

3 Answers 181 Views
Upload (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Moustafa
Top achievements
Rank 1
Moustafa asked on 14 Oct 2008, 07:45 AM
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

3 Answers, 1 is accepted

Sort by
0
Erjan Gavalji
Telerik team
answered on 14 Oct 2008, 08:02 AM
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.
0
Moustafa
Top achievements
Rank 1
answered on 14 Oct 2008, 08:15 AM

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.??
0
Lini
Telerik team
answered on 16 Oct 2008, 11:25 AM
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.
Tags
Upload (Obsolete)
Asked by
Moustafa
Top achievements
Rank 1
Answers by
Erjan Gavalji
Telerik team
Moustafa
Top achievements
Rank 1
Lini
Telerik team
Share this question
or