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

Setting properties in the code behind for the grid edit demo.

1 Answer 47 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
Atlas
Top achievements
Rank 1
Atlas asked on 17 Aug 2010, 06:05 PM
What event do I tie into to set the properties for this control programmatically?
http://demos.telerik.com/aspnet-ajax/controls/examples/integration/gridandradasyncupload/defaultcs.aspx?product=upload
should I use a grid databinding event or an asynch prerender or oninit event?
Can you show a code sample based on the example?

1 Answer, 1 is accepted

Sort by
0
Atlas
Top achievements
Rank 1
answered on 19 Aug 2010, 01:57 AM
I figured it out:
protected void RadGrid1_ItemDataBound(object sender, GridItemEventArgs e)
{
    if (e.Item is GridEditableItem && e.Item.IsInEditMode)
    {
        RadAsyncUpload AsyncUpload1 = (RadAsyncUpload)e.Item.FindControl("AsyncUpload1");
        int iMaxFileSize = Convert.ToInt32(ConfigurationManager.AppSettings["FileSizeLimit"]);
        int intBytesPerMegaByte = Convert.ToInt32(ConfigurationManager.AppSettings["BytesPerMegaByte"]);
        string[] aValidFileTypes = ConfigurationManager.AppSettings["ValidFileExtensionListUpload"].Split(',');
        if (AsyncUpload1 != null)
        {
            //AsyncUpload1.TargetFolder = "";
            AsyncUpload1.AllowedFileExtensions = aValidFileTypes;
            AsyncUpload1.MaxFileSize = iMaxFileSize;
        }
    }
}
Tags
AsyncUpload
Asked by
Atlas
Top achievements
Rank 1
Answers by
Atlas
Top achievements
Rank 1
Share this question
or