| | |
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 3.5 ajax alltypeofvideos appliances asp asp.net beginner box browser businesslogiclayer button c# cac checkbox class commonfunctions compatible content contenttype countryselector courier dataaccesslayer database datagrid datagridview datalist deployment development dgv dialog dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formatdecimal formview gridview gudi iis javascript list listbox menu microsoft mouse mssql nameisnotdeclared news novell numerical opera order panelmasterpagebuttoncontrols problem radio ratings redirect registration relationaldatabases reportemail schoolproject search security serializesmo.table sessionvariables silverlight smoobjects software sql sql-server sqlserver2005 ssl tracking treeview unauthorized validatedate validation vb.net videos vista visual-studio visualstudio vs2008 web webapplications webarchitecture webdevelopment webprogramming webservice xsl youareanotmemberofthedebuggerusers





