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

2 posts, 0 answers
  1. Atlas
    Atlas avatar
    97 posts
    Member since:
    Jun 2009

    Posted 17 Aug 2010 Link to this post

    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?
  2. Atlas
    Atlas avatar
    97 posts
    Member since:
    Jun 2009

    Posted 18 Aug 2010 Link to this post

    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;
            }
        }
    }
Back to Top