Hello how can i add to imagebutton mouse leave event to run pagemethod i can't use javascript any idea?
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Zadanie_1_rysunki._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body><center>
<form id="form1" runat="server">
<asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/img/1.jpg" />
<div>
</div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
</form>
</center>
</body>
</html>
Since you have 'EnablePageMethods' set to "true", I believe you can set the OnMouseLeave event to
"PageMethods.MyPageMethod(param1, param2, paramN);"
Related
I have my aspx as below:
<%# Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<ajaxToolkit:ToolkitScriptManager id="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
<div>
<asp:TextBox runat="server" ID="txtDateFerie" autopostback="True"/>
<asp:Button runat="Server" ID="ibtnDateFerie"
CausesValidation="False" />
<ajaxToolkit:CalendarExtender Format="dd/MM/yyyy" ID="cbeDateFerie" runat="server" Enabled="True"
TargetControlID="txtDateFerie" PopupButtonID="ibtnDateFerie" />
</div>
</form>
</body>
</html>
I have AjaxControlToolkit.dll and System.Web.Extensions.dll in my project. However, when I click on the button, the calendar is not shown. I have looked for an answer on the internet, and it seems I am not missing anything here. Any idea where the problem may be?
I am trying to develop an Ajax based website. where is installed ajax control toolkit on visual studio 2010. I created a page.
Here is the code
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="test2.aspx.cs" Inherits="QMSStandard.test2" %>
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="TextBox1">
</asp:CalendarExtender>
</div>
</form>
when I run this page its shows error
Error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure
the correct version of the scripts are referenced. If you are using an
ASP.NET ScriptManager, switch to the ToolkitScriptManager in
AjaxControlToolkit.dll.
Kindly suggest how can i use these controls.
first remove <asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager> and then drag and drop <asp:ToolkitScriptManager> from Ajax Toolbox control
I have tried this code to disable future dates to be selected but it does not seem to be working.
public void Calendar1_DayRender(object o, DayRenderEventArgs e)
{
if (e.Day.Date < DateTime.Today)
{
e.Day.IsSelectable = false;
}
}
<%# Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server" />
<link href="CSS.css" rel="stylesheet" type="text/css" />
<script src="Extension.min.js" type="text/javascript"></script>
<asp:TextBox ID="txtDate" runat="server" CssClass="disable_future_dates" />
<asp:ImageButton runat="server" ID="imgPopup" ImageUrl="~/Calendar.png" />
<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDate"
PopupButtonID="imgPopup" />
</form>
</body>
</html>
Disabling Future Dates
In order to disable future dates we need to follow 2 simple steps.
Add CSS.css and Extension.min.js files just below the ScriptManager as shown in the HTML Markup above.
Set the CssClass property to disable_future_dates for the TextBox control associated with the CalendarExtender for which you want to disable the future dates.
That’s it you need to do and your AJAX CalendarExtender will now disable the future dates.
Facebook doesn't show thumbnail from my web page
<%# Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="httpdocs_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta property="og:image" runat="server" content="http://fuzzel.org/Images/mercedes.jpg"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Welcome to Fuzzel
</div>
</form>
</body>
</html>
and I also get Message 1 Validation (HTML5): Attribute 'property' is not a valid attribute of element 'meta' message.
I also used developers.facebook.com/tools/debug and it shows thumbnail there, but when i post www.fuzzel.org as a status, it doesn't show thumbnail
I've created one aspx page Default.aspx. It contains iframe with child.aspx. File Child.cs contains web methods which should be called by parent page.
As I understand I need to receive the instance of Child class so then I'll be able to them call. How can I make this?
I will be really appreciated for constructive solution,
Default.aspx (Parent page)
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="Parent_Child_Iframe._Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:Button ID="btGetDataFromChild" runat="server" Text="Get Data from Child" />
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<iframe id="I1" height="300px" name="I1" src="child.aspx" width="400px"></iframe>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
Child.aspx
<%# Page Language="C#" AutoEventWireup="true" CodeBehind="Child.aspx.cs" Inherits="Parent_Child_Iframe.Child" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<br />
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</div>
</form>
</body>
</html>
Child.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Parent_Child_Iframe
{
public partial class Child : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string getResultData ()
{
return TextBox1.Text + TextBox2.Text;
}
}
}
So How I can call getResultData () from Child.aspx.cs by clicking Button on the parent page.
The main difficulty is that I can't use Javascript to collect the information from TextBoxes because the task is more complicated and I can use only server methods.
Thank you in advance,
Best wishes,
Greg.
Thats not really the way iframes work. Remember, HTTP is a stateless protocol, which means that each request for a page is an independent request, and won't have any context of the previous request. What I think you would need to do, is either request the Child.aspx page with specific form or request variables, and the Child page should output the correct page accordingly.
Could you explain what it is you want to achieve?