Skip to Content
avatar image
Former Member

How to call a dynamic URL on 'button press' event, in MVC-based BSP

Hi,

My requirement is as below:

On selecting a row in table view, and pressing a button, I need to open a browser.

The Browser URL depends on the row selected.

The key field from table view, is added at the end of the URL string.

Shortly, I can say that, I am getting a value on row selection & want to pass it to button event.

In Views Section, there are 2 tags- (1)table view & (2)button.

Right now, I have put the code for getting the key field, in DO_HANDLE_DATA method.

In Button's OnClientClick method, I have called the Javascript to open the browser.

If I now write the code to concatenate the key field value to form the dynamic URL in 'OnClick' method,

it will be called only after the browser is opened.

(as OnClick event is executed only after OnClientClick event is executed)

Could anyone please tell me what event (and in which tag) can be used to solve this.

Is there any event which is triggered, as soon as the row is selected, & before the button press event is triggered ?

Would really appreciate responses made to this query.

Thanks,

Nisha Vengal.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 03, 2008 at 12:46 PM

    Hi,

    The idea is to use the onClientRowSelection attribute of the tableview. This attribute enables you to handle a client-side event whenever a row is selected. The handling of this event should update the action attribute of your form (which has the target="_blank" attribute value).

    I would have post some code, but Javascript cannot be posted here on SDN... Sorry, you will have to search the weblogs and/or articles, I am pretty sure this has already been treated.

    Regards,

    Tanguy

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Thankyou Tanguy, You are superb !

      I highly appreciate and admire your helping nature.

      Best Regards,

      Nisha Vengal.

  • avatar image
    Former Member
    Sep 07, 2008 at 10:07 AM

    Hi Nisha,

    The crux of your issue here is that you want to call the event triggered with onClick before calling the event triggered on onClientClick. This can be achieved by the following code in the function called on the onClientClick.

    function fn_button()

    {

    htmlbSL(this,2,'b_row_selection:onInputProcessing()');

    window.open("new_page",target="BLANK");

    }

    Here, fn_button is the javascript function called on button click, and b_row_selection is the event triggered on the onClick event of row selection.

    Try this out and let us know if it works for you.

    Regards,

    Saurabh

    Add comment
    10|10000 characters needed characters exceeded