Auto resizable Textarea in Framwork 7 on typing and loading.

Resize textarea when user start entering data (Typing), use class=”resizable”.

 ‘<textarea id=”txtLabel” class=”resizable”></textarea>’
On load trigger change event after adding value.

 

var strDescription = “Any Description”;

$$(“#txtLabel”).html(strDescription).trigger(‘change’);

Ajax (Asynchronous) call to Controller in MVC 5 (Razor view) with Jquery

View (Razor)

<fieldset>
<legend>Add Comment</legend>

@Html.Hidden(“hdnHidden”)
@Html.Label(“txtComment”)
@Html.TextArea(“txtComment”, new { rows = 10, columns = 40 })

<p>
<input type=”button” onclick=”SaveComment()” value=”Save” />
</p>
</fieldset>

Javascript (Jquery Ajax Call)

function SaveComment() {
var objData = new Object();
objData.HKID = $(“#hdnHidden”).val();
objData.Comment = $(“#txtComment”).html();
$.ajax({
cache: false,
type: “POST”,
url: “/hisab/UpdateComment/”,
data: objData
}).done(function (data) {
alert(data);
}).error(function (err) {
alert(“err”);
});
}

C# Model

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace HisabKitab.Models
{
public class DailyHisab
{
public int HKID { get; set; }
public string Comment { get; set; }
public bool Status { get; set; }
}
}

C# Controller

[HttpPost]
public void UpdateComment(DailyHisab DH)
{
Response.Write(“Update Succesfully”);
}

ASP.NET Advanced Generic Handler ASHX Introduction

Generic handlers are the .NET component, In general generic handlers have an extension of ASHX.
I see a lot of people using pages to process AJAX requests when we can use this much less expensive endpoint. This is an completely worked out Generic Handler that truly knows how to handle your http (AJAX) requests.
Using the code-
1-Create a new Generic Handler
2-Clear everything inside the handler class
3-Inherit from my Handler class
4-DONE! Now you only need to add your methods.

HTML

<!DOCTYPE html>
<html xmlns=”http://www.w3.org/1999/xhtml”&gt;
<head>
<title></title>
<!– Include your Jquery file here –>
http://jquery-2.1.1.js

function SaveTextBoxData() {
var objData = new Object();
objData.userPass = $(“#txtname”).value;
$.ajax({
cache: false,
type: “POST”,
url: “../Handler1.ashx?ACTION=savenamedata”,
data: objData
}).done(function (data) {
alert(data);
});
}

</head>
<body>

Save

</body>
</html>

 

Handler1.ashx

<%@ WebHandler Language=”C#” Class=”Handler1″ %>

using System;
using System.Web;

public class Handler1 : IHttpHandler {
public void ProcessRequest(HttpContext context)
{
string retvalue = “”;
string ACTION = context.Request.QueryString[“action”];
switch (ACTION)
{
case “savenamedata”: retvalue = SaveNameData(context); break;
}

context.Response.ContentType = “Application/Json”;
context.Response.Write(retvalue);
}
public bool IsReusable
{
get
{
return false;
}
}
public string SaveNameData(HttpContext context)
{
string rest=””;
var obj = context.Request.Form;
rest = obj[“userPass”].ToString();

return rest;
}
}

 

Framework7 – HTML Framework For Building iOS & Android Apps & Mockups

Framework7 – is a free and open source mobile HTML framework to develop hybrid mobile apps or web apps with iOS & Android native look and feel. It is also an indispensable prototyping apps tool to show working app prototype as soon as possible in case you need to.

The main approach of the Framework7 is to give you an opportunity to create iOS & Android apps with HTML, CSS and JavaScript easily and clear. Framework7 is full of freedom. It doesn’t limit your imagination or offer ways of any solutions somehow. Framework7 gives you freedom!

Framework7 is not compatible with all platforms. It is focused only on iOS and Google Material design to bring the best experience and simplicity.