How to pass textbox value in the javascript string? [Resolved]

Posted by Laghaterohan under C# on 9/29/2010 | Points: 10 | Views : 3448 | Status : [Member] | Replies : 2
I am developing application in vs2008/ C#3.0

Please find my below code:

ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Test",javascript:window.open('ReportViewer.aspx?report_name=My_Report&id=77 )", true);'


In the above code 77 is an hard coded value;Instead i will pass this value from the textbox. How to do it?? Please suggest.

I tried the following Code but it did not work ! Please suggest.

ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Test",javascript:window.open('ReportViewer.aspx?report_name=My_Report&membership_id='"+txtMembershipID.Text +"')", true);


Please suggest how to do it..

Thanks !
Rohan Laghate

Best Regards,
Rohan Laghate



Responses

Posted by: Laghaterohan on: 9/29/2010 [Member] Starter | Points: 50

Up
0
Down

Resolved
Hi!

Well, the above code did not solve my problem either!!

Instead i used the following syntax and it worked!!

ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Test","javascript:window.open('ReportViewer.aspx?report_name=My_Report&membership_id=" + txtMembershipID.Text +"');", true);



Thanks!
Rohan Laghate

Best Regards,
Rohan Laghate

Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Samy33 on: 9/29/2010 [Member] Starter | Points: 25

Up
0
Down
Single Codes Only Needed for Passing the Values into the javascript

ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "Test",javascript:window.open('ReportViewer.aspx?report_name=My_Report&membership_id=' +txtMembershipID.Text + ')", true);

Laghaterohan, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response