locked
Image Field Template - Can't upload RRS feed

  • Question

  • User1980140492 posted

    Guys,

    In my project I'm using Sjnaughton's image field template, but I can't seem to be able to upload anything.
    The template:
    http://csharpbits.notaclue.net/2011/07/dynamic-data-image-field-template.html

    When editting a record it saves everything except the image itself.

    Now I do remember an older post of mine where I was talking about "DynamicDataFutures.DisablePartialRenderingForUpload".
    Which method is this in the .NET 4.0 version?

    Regards,
    - Yannick

    Tuesday, November 15, 2011 4:50 AM

All replies

  • User3866881 posted

    Now I do remember an older post of mine where I was talking about "DynamicDataFutures.DisablePartialRenderingForUpload".
    Which method is this in the .NET 4.0 version?

    In fact Sjnaughton's articles have talked about this method, If I take you right, I think this method is written by yourself, something looks like this following:

    public static void DisablePartialRenderingForUpload(Page page, MetaTable table)
        {
            foreach (var column in table.Columns)
            {
                // TODO this depends on the name of the field template, need to fix
               
    if (String.Equals(column.UIHint, "DBImage", StringComparison.OrdinalIgnoreCase)
                    || String.Equals(column.UIHint, "FileImage", StringComparison.OrdinalIgnoreCase))
                {
                    var sm = ScriptManager.GetCurrent(page);
                    if (sm != null)
                    {
                        sm.EnablePartialRendering = false;
                    }
                    break;
                }
            }
        }

    It should have no relation with version of net framework, because it's a DIY method.

    If I took you wrongly, please tell me kindly:)

    Best reguards!

    http://csharpbits.notaclue.net/2008/07/dynamic-data-part-2-fileimageedit.html (This is where I referred the article)

    Wednesday, November 16, 2011 8:29 PM
  • User-330204900 posted

    Try using the new one from NuGet here Dynamic Data Custom Field Templates

    Thursday, November 17, 2011 8:36 AM
  • User1980140492 posted

    Stephen,

    That link doesn't seem to work.

    Regards,
    - Yannick

    Friday, November 18, 2011 8:59 AM
  • User-330204900 posted

    Thsi seems to happen all the time the system messes up my URLs Yell Arrgh!

    I'll fix it

    Friday, November 18, 2011 9:37 AM
  • User-330204900 posted

    it's fixed

    Friday, November 18, 2011 9:38 AM
  • User1980140492 posted

    Stephen,

    Do you have a sample project by any chance?
    I still can't get anything uploaded ... in the UploadImage_Edit template in the ExtractValues method my FileUpload1.HasFile is always false for some reason ... happen to have an idea?

    Thanks in advance,
    - Yannick

    Wednesday, December 7, 2011 5:33 AM
  • User-330204900 posted

    You will need to turn Partial rendering off in the site .master to do that or use thos extension method,

    /// <summary>
    /// Disables the partial render.
    /// </summary>
    /// <param name="page">The page.</param>
    public static void DisablePartialRender(this Page page)
    {
        var sm = ScriptManager.GetCurrent(page);
        if (sm != null)
            sm.EnablePartialRendering = false;
    }
    Wednesday, December 7, 2011 8:27 AM
  • User1980140492 posted

    Well I need EnablePartialRendering to be true for other reasons, what do I do now?

    I did try to turn it to false and like you said it works in that case, but as you can understand I need the partialrendering for the rest of the app to run smoothly.
    Where exactly do I call that extention method?

    Regards,
    - Yannick

    Thursday, December 15, 2011 6:51 AM
  • User-330204900 posted

    Hi Yannick, EnablePartialRender="true" uses AJAX post back to make the page update without a full postback, so no it is not essential but it does make your page updates look smoother.

    Friday, December 16, 2011 5:41 AM