Link to home
Start Free TrialLog in
Avatar of brgdotnet
brgdotnetFlag for United States of America

asked on

Need help with building query string

I have a hyplerlink below which I create in C#. I am redirecting to an asp.net page and sending "Id" in the query string. I can hard
code it as shown below in my current example. However I need to pass in a string for the value of 3 instead of hard coding it.
I can't figure out how to build my string. Look at the code below labeled "Desired". Can someone show me how to correctly quote my
value for MyNumber so that it is passed into the query string?



// Current
HyperLink link = new HyperLink();
link.NavigateUrl = "javascript:window.ShowModalDialog('\\MyPage.aspx?Id=3' " + "," + " ' MyLink ' ", 'resizeable=no,width=300,height=300');void(0);"

// Desired
string MyNumber = 3;
HyperLink link = new HyperLink();
link.NavigateUrl = "javascript:window.ShowModalDialog('\\MyPage.aspx?Id=' " +  MyNumber   + "," + " ' MyLink ' ", 'resizeable=no,width=300,height=300');void(0);"
ASKER CERTIFIED SOLUTION
Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of brgdotnet

ASKER

Thanks, you save my life !!!!!!!!!