Related Links

Open new tab only if query returns data

In my previous (resolved) post I described Page1.aspx with
dropdownlist and button which when clicked opened Page2.aspx in a new tab.

In my project, button_click should open Page2.apsx only if a query returns data. If query result is null page1.aspx should be the only page open and allow to make different selection in the dropdownlist.

I cannot figure out how to modify "SetTarget()" function to set target to "_blank" or to "_self", based on the condition of query result in button_click event.

Below I copied code from my previous post with Boolean query result condition added in button_click event to possibly be used in the SetTarget() function.

Re: Open new tab only if query returns data

You can't check that when building your drop down ? It would seem better to let the user know which values would produce no result anyway (they could be disabled or dimmed).

At worst using Ajax and caching the result so that you can then take the decision about what to do next. It's likely too late when the next page is already triggered. Windows are handled on the client side only so you have no direct control on this from
the server side.