i have two problem
1. how to call a javascript function from form page and also how to
call c# function from javascript because when user click on button i
want to validate field of form and if validation is correct then call
to c# function .
please any no about this reply
2. in second i have button when i click on button a calender shown and
i collect date but problem is when i click on button i page reload , i
want to stop reloading of page
in coding i set the value of calender visible true
please any body no about answer reply me
Problem with javascript and reload page
3 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Bechir BejaouiRank #144 · 15.9K pointsPosted Aug 13, 2008, 12:52 PM EDT
for 2. use an html buton instead of a server side button
Rohan Varekar26 pointsPosted Jun 24, 2009, 4:04 AM EDT
On button click call javascript function say
<script lagnuage="javascript" type="text/javascript">
function urfunname()
{
}
</Script>
on button click use onClientClick method ( Vs 2005)
<asp:button runat="server" id="btn" OnClick="btn_click" onClientClick="javascript:urfunname()"/>
if u unable to get Onclientclick
add in form load evnet like
Button1.Attribute.Add("onclick","urfunname()")
this will validate ur func in javascript and if u validated then only it will go in C# code else not
Rohan Varekar26 pointsPosted Jun 24, 2009, 4:07 AM EDT
same u use javascript only
to open ur calender on click on button call javascript and open calender control this will not refresh ur page
If u have any problem mail back to me @ [email protected]