| | |
how to call a function from .aspx.cs file to .aspx file
Please support our ASP.NET advertiser: Intel Parallel Studio Home
![]() |
•
•
•
•
hi all,
I am developing a web application. I have written one function in .aspx file. Now i want to call that function from the .aspx.cs file. How can I do this? Can anybody help me regarding this?
thanks in advance
something like:
asp.net Syntax (Toggle Plain Text)
Page.ClientScript.RegisterStartupScript(this.GetType(), "Test", "YourFunctionName();",true);
Or you can also attach a JavaScript event to a Server Control like:
asp.net Syntax (Toggle Plain Text)
Button1.Attributes.Add("onclick", "YourFunctionName();");
Or the other easy option would be
asp.net Syntax (Toggle Plain Text)
Response.write("<script>YourFunctionName(); <\script>")
Last edited by peter_budo; Dec 3rd, 2008 at 7:06 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Njoy koding... >>>
•
•
Join Date: Aug 2008
Posts: 27
Reputation:
Solved Threads: 0
hi vizy,
The error i am getting is due to the javascript error.. It is showing the error function name javascript error.. object is expected..
I want to pass the parameter inside the function.
I have written function as follows in .aspx file
The error i am getting is due to the javascript error.. It is showing the error function name javascript error.. object is expected..
I want to pass the parameter inside the function.
I have written function as follows in .aspx file
JavaScript Syntax (Toggle Plain Text)
<script type="text/javascript"> function func(DropDownList1.SelectedIndex, startDate, endDate) { .... } </script>
Last edited by peter_budo; Dec 3rd, 2008 at 7:07 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Hi Sancti
Are you passing the parameter values to the function
As follows...
Are you passing the parameter values to the function
As follows...
Response.write("<script>func('"+DropDownList1.SelectedIndex+"','"+ startDate+"','"+ endDate+"')</script>"); Last edited by peter_budo; Dec 3rd, 2008 at 7:07 pm. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
Njoy koding... >>>
![]() |
Similar Threads
- File mapping problem (C++)
- Getting a C# program with a manifest file to run in the debugger (C#)
- How do I play sounds? (C)
- How to call a class (VB.NET)
- How to create a global function/class ? (C#)
- How can i retrieve data after i logod on..... (ASP.NET)
- Strings help (C#)
- Why app is looking for "Default.aspx" (ASP.NET)
- Parse XML from ASP!!! (ASP)
Other Threads in the ASP.NET Forum
- Previous Thread: Runtime Error
- Next Thread: Disable toolstripbutton in c# windows application
| Thread Tools | Search this Thread |
.net 2.0 activexcontrol advice ajax alltypeofvideos asp asp.net bc30451 bottomasp.net box browser button c# c#gridviewcolumn checkbox click commonfunctions compatible confirmationcodegeneration content contenttype courier css dataaccesslayer database datagridview datagridviewcheckbox datalist deadlock development dgv dropdownlist dynamically edit expose fileuploader fill flash formatdecimal forms formview gridview gudi homeedition iframe iis javascript jquery listbox login microsoft mono mouse mssql multistepregistration news numerical objects opera panelmasterpagebuttoncontrols radio ratings redirect registration relationaldatabases reportemail rotatepage save schoolproject search security serializesmo.table silverlight smartcard smoobjects software sql-server sqlserver2005 suse textbox tracking unauthorized validation vb.net video videos virtualdirectory vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webprogramming webservice xml xsl youareanotmemberofthedebuggerusers





