Thursday 6 December 2012

Issue in modalpopupextender when clicking enter key in textbox Or Trigger a Button Click with JavaScript on the Enter key in a TextBox

Issue in modalpopupextender when clicking enter key in textbox Or Trigger a Button       Click with JavaScript on the Enter key in a TextBox
<%@ Register Assembly="AjaxControlToolkit"Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Issue in modalpopupextender when clicking enter key in textbox Or Trigger a Button
        Click with JavaScript on the Enter key in a TextBox</title>
    <script language="javascript" type="text/javascript">
        function btnclick() {
            alert("Hi");
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
        <ajax:ModalPopupExtender ID="ModalRecipients"BehaviorID="ModalRecipients" runat="server"
            PopupControlID="pnlRecipients" DropShadow="true"
            TargetControlID="btnMain"BackgroundCssClass="modalBackground">
        </ajax:ModalPopupExtender>
        <div style="overflow: auto;">
            <asp:Panel ID="pnlRecipients" runat="server" Width="550px"Style="background-color: White;
                display: none">
                <asp:TextBox runat="server" ID="txt" onkeydown="if (event.keyCode == 13) document.getElementById('btn').click()" />
                <asp:Button runat="server" ID="btn" OnClick="btn_Click"Text="button" />
            </asp:Panel>
              <asp:Button runat="server" ID="btnMain"OnClick="btnMain_Click" Text="MainPage Button"  UseSubmitBehavior="false" />
        </div>
    </div>
    </form>
</body>
</html>

C#:
using System.Globalization;


public partial class EnterKeyCheck : System.Web.UI.Page
{
    protected void btn_Click(object sender, EventArgs e)
    {
        Response.Write(txtData.Text );
    }
   
    protected void btnMain_Click(object sender, EventArgs e)
    {
        ModalRecipients.Show();
    }
  
}


VB.NET:
Imports System.Globalization

Partial Public Class EnterKeyCheck
    Inherits System.Web.UI.Page
    Protected Sub btn_Click(ByVal sender As ObjectByVal e As EventArgs)
        Response.Write(txtData.Text )
    End Sub

    Protected Sub btnMain_Click(ByVal sender As ObjectByVal e As EventArgs)
        ModalRecipients.Show()
    End Sub

End Class



Output:




How to convert dd-mm-yyyy into dd/mm/yyyy in ASP.NET using C#/VB.NET

How to convert dd-mm-yyyy into dd/mm/yyyy in ASP.NET using C#/VB.NET

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>How to convert dd-mm-yyyy into dd/mm/yyyy in ASP.NET using C#/VB.NET</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:TextBox ID="txtDate" runat="server"></asp:TextBox><br />
        <asp:Label ID="lblDate" runat="server"></asp:Label><br />
        <asp:Button ID="btnConvert" Text="Convert" runat="server"
            onclick="btnConvert_Click" />
    </div>
    </form>
</body>
</html>

In C#:
using System.Globalization;

public partial class DateConversion : System.Web.UI.Page
{
       #region How to convert dd/mm/yyyy into dd-mm-yyyy

    protected void btnConvert_Click(object sender, EventArgs e)
    {
        DateTime dt = DateTime.ParseExact(txtDate.Text, "dd/MM/yy", CultureInfo.InvariantCulture);
        lblDate.Text = dt.ToString("dd-MM-yyyy");
    }
    #endregion
}


In VB.NET:
Imports System.Globalization

Partial Public Class DateConversion
    Inherits System.Web.UI.Page
#Region "How to convert dd/mm/yyyy into dd-mm-yyyy"

    Protected Sub btnConvert_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim dt As DateTime = DateTime.ParseExact(txtDate.Text, "dd/MM/yy", CultureInfo.InvariantCulture)
        lblDate.Text = dt.ToString("dd-MM-yyyy")
    End Sub
#End Region
End Class

Output:


Monday 26 November 2012

HTML helpers in ASP.NET MVC 2


HTML helpers in ASP.NET MVC 2

DisplayFor: Returns HTML markup for each property in the object that’s represented
by the expression.

Sunday 25 November 2012

AngularJS tutorial for beginners or Introduction to Angular JS

What is AngularJS:
AngularJS is an open-source JavaScript framework, maintained by Google, that assists with running single-page applications. Its goal is to augment browser-based applications with model–view–controller (MVC) capability, in an effort to make both development and testing easier.

Angular JS Email Validation in ASP.NET


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css" >
    .error
    {
        color:Red;
    }
© 2012-2018 Aspdotnet-Kishore.blogspot.com. All Rights Reserved.
The content is copyrighted to Kishore and may not be reproduced on other websites without permission from the owner.