ASP.NET C# RegisterClientScriptBlock

I want to convert this Javascript on Client page to the Code Behind C# page .....

string strCsharp = "CsharpPage"; //// Only this variable is being passed from Code Behind.. It has to be written on server side when a button is clicked....
            <script language="javascript">
            function GetPage()
                         var frm = document.forms[0];
                         frm.HiddenStudent.value = 'yes';  // Hiddenvariable
                         frm.HiddenGoToPage.value = 'Admin.aspx';
                         frm.HiddenCSHARPVALUE.value = strCsharp;  //value being passed from csharp code behind
                         frm.document.action = 'GotoASPPage.asp';
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dotnet0824Author Commented:
I am not familiar in writing the Syntax on The server side. Can it be shown
dotnet0824Author Commented:
C#  code Behind Page

private void Button_click Event
        the script goes here //
I'm typing this in off the top of my head, but it should be pretty close to being syntactically correct.
private void Button_click
//create a string which has your javascript function in it
string js="function GetPage()";
js += "{"
js += "var frm = document.forms[0];";
js += "frm.HiddenStudent.value = 'yes';"
js +="frm.HiddenGoToPage.value = 'Admin.aspx';";
//concatenate the value you need here
js +="frm.HiddenCSHARPVALUE.value =" + strCsharp;  //value being passed from csharp code behind
js += "frm.document.action = 'GotoASPPage.asp';";
js += "}";  
//add this to your web page. the first parameter doesn't mean much - just a function name
Page.RegisterStartupScript("AnyNameHere", js, true);

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
dotnet0824Author Commented:
Thanks a lot.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.