Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • mukund rayate 22 posts 172 karma points
    May 26, 2016 @ 09:11
    mukund rayate
    0

    radio butoon list , selected value in partial view

    How to access radio button list selected value in PartialViewMacroPage ?

  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    May 26, 2016 @ 09:13
    Dennis Aaen
    0

    Hi Mukund and welcome to our :-),

    Try to see this documentation on how to get data from a radio button list.

    https://our.umbraco.org/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/RadioButton-List

    Hope this helps,

    /Dennis

  • mukund rayate 22 posts 172 karma points
    May 26, 2016 @ 09:16
    mukund rayate
    0

    Hello Dennis, i have tried same but every time i get 'true' value for my radio button list , i want selected options value . hear is my code

    @inherits Umbraco.Web.Macros.PartialViewMacroPage 
    
    @{ var home = @Umbraco.TypedContentAtRoot(); string  mediaIds = ""; var GalID = CurrentPage.TopBannerID; var Seektime=0;var Isautoplay=false;var IsActive = true; var strIsautoplay = "";}
    
    
    
    @foreach (var childPage in home)
    {
        if (childPage.DocumentTypeAlias == "gallerys")
        {
            foreach (var childsubPage in childPage.Children)
            {
                if (childsubPage.DocumentTypeAlias == "gallery")
                {
                    if (childsubPage.Id == GalID)
                    {
                        if (childsubPage.GetPropertyValue<Boolean>("active"))
                        {
                            mediaIds = childsubPage.GetPropertyValue<string>("selectimages");
                            Seektime = childsubPage.GetPropertyValue<Int32>("Seektime");
                            Isautoplay = childsubPage.GetPropertyValue<Boolean>("AutoPlay");
                            break;
                        }
                        else
                        {
                            IsActive = false;
                        }
                    }                
                }
            }       
        }
    }
    
  • Dennis Aaen 4500 posts 18255 karma points admin hq c-trib
    May 26, 2016 @ 10:22
    Dennis Aaen
    101

    Hi Mukund,

    Try to change:

    if (childsubPage.GetPropertyValue<Boolean>("active"))
        {
            mediaIds = childsubPage.GetPropertyValue<string>("selectimages");
            Seektime = childsubPage.GetPropertyValue<Int32>("Seektime");
            Isautoplay = childsubPage.GetPropertyValue<Boolean>("AutoPlay");
            break;
        }
    

    To something like this.

    if (childsubPage.HasValue("active"))
    {
        var preValue = Umbraco.GetPreValueAsString(childsubPage.GetPropertyValue<int>("active"));
        @preValue
    
        mediaIds = childsubPage.GetPropertyValue<string>("selectimages");
        Seektime = childsubPage.GetPropertyValue<Int32>("Seektime");
        Isautoplay = childsubPage.GetPropertyValue<Boolean>("AutoPlay");
        break;
    }
    

    So the @preValue should give you the value that, you have secreted.

    Hope this helps,

    /Dennis

  • mukund rayate 22 posts 172 karma points
    May 26, 2016 @ 10:53
    mukund rayate
    0

    Thanks Dennis , it works fine. it solved my problem. :-)

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies