Archive for April, 2017

Read Resulting HTML Page code in asp.net

Add below mention assembly in your project.

using System.Net;
using System.Text;

try

{

WebClient myClient = new WebClient();

string myPageHTML = null;

byte[] requestHTML;

string currentPageUrl = “https://abcd1212.com/webpage.aspx”;

UTF8Encoding utf8 = new UTF8Encoding();

requestHTML = myClient.DownloadData(currentPageUrl);

myPageHTML = utf8.GetString(requestHTML);

Response.Write(myPageHTML);

}

catch (Exception ex)

{

}

If you like this post, request you to put your comment.

 

Call Button server event on enter key pressed in password textbox

<html>
<head>
http://../JQuery/jquery-1.7.2.js

$(document).ready(function () {
$(‘#txtPassword’).keypress(function(e)
{
var key = e.which;
if(key == 13)
{
//$(‘#btnSubmit’).click();
$(“#btnSubmit”)[0].click();
//alert(‘hi1’);
//return false;
}
});

});

</head>
<body>
<form id=”form1″ runat=”server”>
<fieldset>

 <asp:TextBox ID=”txtUser” runat=”server” class=”form-control” placeholder=”UserID”
MaxLength=”8″></asp:TextBox>
<asp:TextBox ID=”txtPassword” runat=”server” class=”form-control” placeholder=”Password”
TextMode=”Password”></asp:TextBox>
<asp:LinkButton ID=”btnSubmit” runat=”server” class=”btn btn-bricky pull-right”>Login <i class=”fa fa-arrow-circle-right”></i> </asp:LinkButton>

</fieldset>
</form>
</body>

</html>

How to call server side button event using JQuery

<html>
<head>
    <title>Call Server side Button event using JQuery</title>
     src="scripts/jquery-1.4.1.min.js" type="text/javascript">
     type="text/javascript">
        $(document).ready(function () {
            $("#lnkbtn").click(function () {
                $("#<%=Button1.ClientID %>")[0].click(); }); }); 
</head> 
<body>  
   <form id="form1" runat="server"> 
     <a id = "lnkbtn" href = "#">Click</a> 
     <asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" /> 
   </form> 
</body> 
</html>