Mark Van
Mark Van

Reputation: 281

Pass parameter to SSRS report, while initializing a default value

I am trying to pass a new parameter to a SSRS report, therefore I have created 2 methods in the Contract class:

    [DataMemberAttribute('LanguageId')]
public LanguageId parmLanguageId(languageId _languageId = languageId)
{

    languageId = _languageId;

    return languageId;
}

And another to retrieve the value:

    public LanguageId getLanguageId()
{
    return languageId;
}

In my DP class I am also retrieving the value:

languageId = _contract.getLanguageId();

So far, so good, the dialog when running my report is passing through the value with the selected Language ID in my dialog.

The problem I'm having, is when initializing a default value in the dialog, it doesn't pass my selected value, but the default value initialized when opening the dialog.

I was thinking to edit my parmLanguageId like:

[DataMemberAttribute('LanguageId')]
public LanguageId parmLanguageId(languageId _languageId = 'DefaultLanguageValue')
{

    languageId = _languageId;

    return languageId;
}

But, then comes the part where I have to change the variable to the selected value, I probably miss a simple solution, but how do I accomplish this?

Upvotes: 1

Views: 2812

Answers (1)

10p
10p

Reputation: 6686

Try overriding method prePromptModifyContract in your report controller class and adding following lines in it:

YourContract contract = this.parmReportContract().parmRdpContract() as YourContract;  
contract.parmLanguageId('DefaultLanguageValue');

Upvotes: 1

Related Questions