Results 1 to 5 of 5

Thread: [RESOLVED] Having problems with navigationManager and a null parameter

  1. #1

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Resolved [RESOLVED] Having problems with navigationManager and a null parameter

    I have a page SystemDataDetails from which I want to navigate to CircuitDetails. Circuits are represented in a grid on SystemDataDetails and you click a row and open the circuit page. I realized I have half the data already in the row that I want to display on the next page so instead of making the next page call the database to get the remaining data, I decided to put all the data in the row (some of it in columns that aren't visible) and I can just pass a boatload of parameters. I didn't know if that was a bad design decision or not - saving a database call vs passing a lot of parameters.

    The problem I'm having is one of the parameters is null. I kept getting "there is nothing at this address" and found it's because providerName is null.
    Here is the call and the page:
    Code:
    navigationManager.NavigateTo($"circuitdetail/{item.CircuitID}/{item.SiteA}/{item.SiteB}/{item.CircuitType}/{item.CircuitUse}/{customerSystem.OwnerID}/{customerSystem.customer_name}/{item.ProviderName}/{item.CircuitBW}/{item.CircuitNotes}");
    
    @page "/circuitdetail/{circuitID}/{siteA}/{siteB}/{type}/{use}/{custno}/{custname}/{provider}/{bandwidth}/{notes}"
    I tried testing for item.ProviderName being null and passing an empty string but it wasn't happy with that either.
    I'm sure with this one particular test case I am just getting lucky that only one of the parameters is null and it will happen with other circuits that other parameters are null.
    So, my ideas to fix is don't pass so many parameters and let CircuitDetails make the call. Or of course understand how to handle null parameter passing. Can you point me in the best direction?
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  2. #2
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,669

    Re: Having problems with navigationManager and a null parameter

    this is all opinion... but ...
    data like that should never be passed around on the URL... at most, you should only be providing just enough details to look up the data. Otherwise your second page becomes dependent on the first ... now when you need to add another piece of data, now you'd have to change two pages... plus now you also need that info in the first just so it can pass it to the second. Yeah, sure it seems simple to just pass it when you've got half the data, but it's a bad idea. You're already going to be making a trip to get the other half of hte data anyways... so just pass over hte minimum needed to get the data no more, no less.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  3. #3

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: Having problems with navigationManager and a null parameter

    @tg - I understand what you're saying, thank you, and all opinions are welcome from those of you way more experienced than I! Let me just repeat the scenario so I know we're clear. One the first page I make a database call to get some data. It seemed more efficient to me, rather than make a second call to get more data on the second page, to just make the one call and get it all. Of course, web may be different than windows in this regard, and I realize it's a lot of parameters to have to deal with.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

  4. #4
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,669

    Re: Having problems with navigationManager and a null parameter

    I didn't say you can't.... I said you shouldn't. I personally wouldn't... there's to much that could go wrong... data that isn't encoded correctly -- this is something we had to deal tih this week when an user tried to enter something with a / in it, and it broke the route it was intended for. There's also only so much you can shove into the URL - there's a length limit. You've also exposed the data raw to the user... what if they then monkey with the data in the url and submit it? I know it seems like it's efficient, but in the end it really isn't. It's also horribly insecure.


    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  5. #5

    Thread Starter
    PowerPoster MMock's Avatar
    Join Date
    Apr 2007
    Location
    Driving a 2018 Mustang GT down Route 8
    Posts
    4,513

    Re: Having problems with navigationManager and a null parameter

    I am learning. I don't mind deferring to other people's advice. Thank you, changing it now. At the very least, it will solve my null parameter problem.
    There are 10 kinds of people in this world. Those who understand binary, and those who don't.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width