Copied to clipboard

Flag this post as spam?

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


  • Brian Olsen 143 posts 424 karma points
    May 27, 2013 @ 12:01
    Brian Olsen
    0

    check if it is empty

    umbraco 4.11.5

    if I go to the page with just "pages.aspx" then it doesn't not check if faser is empty

    but if I go to the page "pages.aspx?faser" then it get it

    so how do i get it to look at "faser" so I can check if it is empty?

       @{
            var faser = Request["faser"];
        var strudeinde = Request["udeinde"];
        var strfag = Request["fag"];
    
    
        if(faser ==""){
        faser = @Model.faser;
    
        }
            @faser
        }

     

  • Fuji Kusaka 2203 posts 4220 karma points
    May 27, 2013 @ 12:05
    Fuji Kusaka
    1

    Hi Brian,

    For QueryString try something like

    var faser = Request.QueryString["faser"];

    if(!String.IsNullOrEmpty(@faser)){
       @faser
    }
  • Brian Olsen 143 posts 424 karma points
    May 27, 2013 @ 12:09
    Brian Olsen
    0

    I still get nothing and now I get nothing if I use pages.aspx?faser=

  • Fuji Kusaka 2203 posts 4220 karma points
    May 27, 2013 @ 12:11
    Fuji Kusaka
    0

    Try this 

    if (!string.IsNullOrEmpty(Request.QueryString["faser"])){
    @Model.faser
    }
  • Brian Olsen 143 posts 424 karma points
    May 27, 2013 @ 12:46
    Brian Olsen
    0

    I still get nothing


  • Fuji Kusaka 2203 posts 4220 karma points
    May 27, 2013 @ 13:12
    Fuji Kusaka
    0

    do you have something in your QueryString? pages.aspx?faser=something

  • Brian Olsen 143 posts 424 karma points
    May 27, 2013 @ 13:16
    Brian Olsen
    0

    no is empty

     

  • Fuji Kusaka 2203 posts 4220 karma points
    May 27, 2013 @ 13:22
    Fuji Kusaka
    1

    But here we are checking if its not empty!! 

    So you want to display something if empty?

     

    if(!string.IsNullOrEmpty(Request.QueryString["faser"])){
    @Model.faser
    }
    else{
    @Model.faser

     

  • Brian Olsen 143 posts 424 karma points
    May 27, 2013 @ 13:25
    Brian Olsen
    0

    yes i want to set "faser" to @model.faser if is empty and if not empty then faser = Request.QueryString["faser"]

  • Brian Olsen 143 posts 424 karma points
    May 27, 2013 @ 15:07
    Brian Olsen
    100

    Hi Fuji

    SORRY my mistake I had "faser" 2 places so thas why it did not as I would :-)

  • 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