Kailash kute
Kailash kute

Reputation: 9

query string in javascript function

i have written the below code now i want to check whether the below code is write bcoz when i run the program it gives me a error help needed am i doing something wrong in below code if yes plz rectify me

i m not sure how to pass query string throrugh javascript

Page.ClientScript.RegisterClientScriptBlock
    (this.GetType(), "OnClick", "<script language=javascript>window.opener.location.href='~/Home.aspx?Flag= + iFlag + &BetaFlag= + iFlagBeta + &iManuf= + iManuf';</script>"
);

thanks in advance

Upvotes: 1

Views: 1101

Answers (2)

Robert Harvey
Robert Harvey

Reputation: 180908

Try this:

Page.ClientScript.RegisterClientScriptBlock
    (this.GetType(), "OnClick", 
    @"<script language=javascript>
        window.opener.location.href='~/Home.aspx?Flag=" + iFlag + "&BetaFlag=" + iFlagBeta + "&iManuf=" + iManuf + "';</script>"
);

Upvotes: 1

Bhavik Goyal
Bhavik Goyal

Reputation: 2796

The problem it seems to be in string creation.

Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "OnClick", "<script language=javascript>window.opener.location.href='~/Home.aspx?Flag=" + iFlag + "&BetaFlag=" + iFlagBeta + "&iManuf=" + iManuf + "';</script>");

Upvotes: 3

Related Questions