Copied to clipboard

Flag this post as spam?

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


  • Giuseppe 2 posts 22 karma points
    Aug 05, 2011 @ 14:07
    Giuseppe
    0

    Using dataeditor control into razor

    hi all,

    i'm writing a memeber's info edit form, i'm looping the propertyes of membertype beacuse there's different membertypes.

    i have found this method :

    member.getProperty("myproperty").PropertyType
                            .GetEditControl(member.getProperty("
    myproperty"), IsPost)
                            .DataEditor
                            .Editor

    that return a ast.net control, can i use it into razor script?

    or there is another way to get the editor control?

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Aug 08, 2011 @ 22:52
    Bo Damgaard Mortensen
    0

    Hi Giuseppe,

    I might be wrong here, but I think you would be better off with populating the member property values into regular HTML inputs and then look for the if(!IsPost). Something like this:

     

    @{
    if(!IsPost)
    {
    // populate values of current member to regular HTML form, i.e.
    <form method="post" action="/this-page.aspx">
    <label for="firstname">Firstname:</label>
    <input type="text" name="
    firstname" id="firstname" value='@member.getProperty("firstname").Value' />
    </form>
    }
    else
    {
    // grab values from the post request, i.e.
    var name = Request["firstname"];
    }

     

    Above snippet is not tested :-) but it should give you an idea of what I mean.

    Is there, by the way, any of your controls that contains prevalues? I.e. a dropdown list, checkbox list etc.

    / Bo

  • Giuseppe 2 posts 22 karma points
    Aug 09, 2011 @ 14:47
    Giuseppe
    0

    "Is there, by the way, any of your controls that contains prevalues? I.e. a dropdown list, checkbox list etc."

    yes there is. 

    what are you wrote is the same that I use now

    I hope into some kind of facilities that make well formatted output, without write all the html and js,

    and a way to iterate all the propertyes making the correnct input control without know the name and the type.

    this because other people maybe (certainly) change the propertyes of member type

    thanks

     

Please Sign in or register to post replies

Write your reply to:

Draft