Tuesday, 16 December 2014

Simple Hide and Show

<input type="radio" name="radio1" id="rbtnsurveyscratch"  value="2"
                        onclick="EditTable.style.display = 'block'; tblSurveyExisting.style.display = 'none'" />DIV-1
                    <input type="radio" name="radio1" id="rdbSurveyExisting" runat="server" value="1"
                        onclick="EditTable.style.display = 'none'; tblSurveyExisting.style.display = 'block'" />Div-2


<div id="EditTable" style="display:none">
    Div-1
</div>


<div id="tblSurveyExisting" style="display:none">
Div-2</div>


Tuesday, 18 November 2014

Place Autocomplete using Google API


https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete-addressform




------------------------------------------

Autocomplete only city

 var options = {
  types: ['(cities)'],

 };
      var input = document.getElementById('searchTextField');

     var  autocomplete = new google.maps.places.Autocomplete(input,options);

Wednesday, 12 November 2014

Convert C# Datetime to Date in jquery


Controller
        public JsonResult Test()
        {
            return Json(DateTime.Now, JsonRequestBehavior.AllowGet);
        }


-------------------------------------------------------------------------------------------------------------------
View-Script

<script type="text/javascript">

        $.ajax({
            type: 'POST',
            contentType: "application/json",
            traditional: true,
            url: '../Home/Test',
            dataType: 'json',
            processData: false,
            success: function (res) {
                         
             
                var pattern = /Date\(([^)]+)\)/;
                var results = pattern.exec(res);
           
                var dt = new Date(parseFloat(results[1]));
                var n = dt.toLocaleDateString();
                alert(n);
                //var sd=(dt.getMonth()+1)  + "/" + dt.getDate() + "/" + dt.getFullYear();
                //alert(sd);
                var n1 = dt.toLocaleString();
                var s = n1.split(',')
                alert(s[0]);
            }
        });
<script>

Monday, 15 September 2014

Modal Popup on link/button click



source: http://getbootstrap.com/javascript/

<!-- Button trigger modal -->
<button class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"  
aria-labelledby="myModalLabel" aria-hidden="true">
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal">
<span aria-hidden="true">&times;</span>
<span class="sr-only">Close</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        ...
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>
 

Tuesday, 21 January 2014


facebook

http://www.asp.net/mvc/tutorials/mvc-4/aspnet-mvc-facebook-birthday-app

http://www.codeproject.com/Articles/569920/Publish-a-post-on-Facebook-wall-using-Graph-API

http://www.c-sharpcorner.com/UploadFile/raj1979/post-on-facebook-users-wall-using-Asp-Net-C-Sharp/

http://blue-and-orange.net/articles/facebook/posting-to-user's-facebook-wall-in-aspnet-mvc-4/


twitter

http://abhi4net.blogspot.in/2013/07/twitter-api-11-integration-with-mvc-in-c.html

http://www.codeproject.com/Articles/114478/Twitter-Made-Easy-Post-to-Your-Twitter-Account-wit

http://tech.avivo.si/2010/09/publish-on-twitter-from-asp-net-mvc-csharp-nice-and-easy/

http://formativeinnovations.wordpress.com/2013/06/12/using-twitter-api-1-1-with-twitterizer-for-c/

http://www.c-sharpcorner.com/UploadFile/4b0136/getting-started-with-twitter-authentication-in-mvc5/

http://www.c-sharpcorner.com/UploadFile/d929bf/post-image-with-message-in-twitter-tweet-in-net-framework-3/

http://www.c-sharpcorner.com/UploadFile/raj1979/authorize-and-post-on-twitter-using-twitterizer/


..........................................





Friday, 17 January 2014

Getting the List of Model data in HttpPost method of Controller

View

@model IList<DTO>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
<div >
            <table>
                <thead>
                    <tr>
                        <th style="text-decoration: underline;cursor: pointer">Name</th>
                        <th style="text-decoration: underline;cursor: pointer">value</th>
                    </tr>
                </thead>
                <tbody>
                    @if (Model != null && Model.Count() > 0)
                    {
                        for (int i = 0; i < Model.Count;i++ )
                        {
                            <tr>
                                <td>@Html.TextBoxFor(m => m[i].Name)</td>
                           
                                <td>@Html.TextBoxFor(m =>  m[i].Value)</td>
                             
                            </tr>
                        }
                    }
                </tbody>
                 <tr>
                <td>
                    <input type="submit" value="Submit" class="redbutton"/>
                </td>
            </tr>
            </table>
            </div>

}

Controller

public ActionResult SystemParameters()
        {
            List<DTO> lstsysparam = new List<DTO>();
            lstsysparam = _iAdminService.GetSystemParameteres();
            return View(lstsysparam);
        }

 [HttpPost]
 public ActionResult SystemParameters(List<SystemParametersDTO> lst)
        {
           // do operations on list.

        }