| | |
how to call a function from .aspx.cs file to .aspx file
Please support our ASP.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
•
•
•
•
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 activexcontrol ajax alltypeofvideos asp asp.net bc30451 beginner bottomasp.net browser businesslogiclayer c# c#gridviewcolumn cac checkbox class commonfunctions compatible confirmationcodegeneration content contenttype countryselector courier dataaccesslayer database datagrid datagridview datagridviewcheckbox datalist deployment development dgv dropdownlist dropdownmenu dynamic dynamically edit embeddingactivexcontrol fileuploader fill findcontrol flash flv formatdecimal forms formview gridview gudi homeedition iis javascript jquery listbox menu microsoft mouse mssql nameisnotdeclared news opera panelmasterpagebuttoncontrols problem redirect registration relationaldatabases reportemail schoolproject security serializesmo.table sessionvariables silverlight smartcard smoobjects software sql sql-server sqlserver2005 ssl textbox tracking treeview unauthorized validatedate validation vb.net video videos vista visual-studio visualstudio web webapplications webarchitecture webdevelopemnt webdevelopment webprogramming webservice youareanotmemberofthedebuggerusers





