@Html.DropDownListFor(m => m.categoryList, new SelectList(Model.categoryList, "Value", "Text")) public IEnumerablecategoryList { get; set; } KochiDealsEntities1 db = new KochiDealsEntities1(); public IEnumerable fetchCategoryList() { var cat = (from m in db.ItemCategories select new { m.CategoryID,m.CategoryName }).AsEnumerable().Select(x => new SelectListItem { Value = x.CategoryID.ToString(), Text = x.CategoryName, Selected = true }); return cat; }
Monday, January 28, 2013
Fill Dropdownlist in mvc
Thursday, January 17, 2013
Login with FaceBook
<script type="text/javascript"> // Load the SDK Asynchronously (function (d) { var js, id = 'facebook-jssdk', ref = d.getElementsByTagName('script')[0]; if (d.getElementById(id)) { return; } js = d.createElement('script'); js.id = id; js.async = true; js.src = "//connect.facebook.net/en_US/all.js"; ref.parentNode.insertBefore(js, ref); } (document)); // Init the SDK upon load window.fbAsyncInit = function () { FB.init({ appId: '198191300293654', // App ID channelUrl: '//' + window.location.hostname + '/channel', // Path to your Channel File status: true, // check login status cookie: true, // enable cookies to allow the server to access the session xfbml: true // parse XFBML }); // listen for and handle auth.statusChange events FB.Event.subscribe('auth.statusChange', function (response) { if (response.authResponse) { // user has auth'd your app and is logged into Facebook FB.api('/me', function (me) { if (me.name) { document.getElementById('auth-displayname').innerHTML = me.name; } }) document.getElementById('auth-loggedout').style.display = 'none'; document.getElementById('auth-loggedin').style.display = 'block'; } else { // user has not auth'd your app, or is not logged into Facebook document.getElementById('auth-loggedout').style.display = 'block'; document.getElementById('auth-loggedin').style.display = 'none'; } }); $("#auth-logoutlink").click(function () { FB.logout(function () { window.location.reload(); }); }); } </script> <h1> Facebook Login Authentication Example</h1> <div id="auth-status"> <div id="auth-loggedout"> <div class="fb-login-button" autologoutlink="true" scope="email,user_checkins">Login with Facebook</div> </div> <div id="auth-loggedin" style="display: none"> Hi, <span id="auth-displayname"></span>(<a href="#" id="auth-logoutlink">logout</a>) </div> </div>
Tuesday, January 15, 2013
jquery tab
$("#existingCustomersTab").find("#customerDetailsDiv").tabs({ select: function (event, ui) { switch (ui.index) { case 0: //Create Ticket Tab break; case 1: //Ticket History Tab Starts var customerIDVal = $("#existingCustomersTab").find("#customerIDText").val(); if (customerIDVal != "") { $.ajax({ url: "CallRegister2.aspx/fetchTicketHistory", data: "{customerID:'" + customerIDVal + "'}", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (data) { var $table = $('<table/>').css("border", "1px solid #111111"); ; var $tr = $('<tr/>').css("border", "1px solid #111111"); ; $tr.append("<th>").append("Complaint No").append("</th>").append("<th>").append("Subject").append("</th>").append("<th>").append("Status").append("</th>").append("<th>").append("Date").append("</th>"); $table.append($tr); $.each(data.d, function (i, item) { var $tr = $('<tr/>').css("border", "1px solid #111111"); ; var $a = $('<a/>').attr('href', 'javascript:void(0)').text(item.complaintNo).css('color', 'blue'); $tr.append("<td>").append($a).append("</td>").append("<td>").append(item.subject).append("</td>").append("<td>").append(item.status).append("</td>").append("<td>").append(item.date).append("</td>"); $table.append($tr); }); $("#existingCustomersTab").find("#ticketHistorySubTab").find("#ticketHistoryDiv").html($table); } }); } //Ticket History Tab Ends break; case 2: var customerIDVal = $("#existingCustomersTab").find("#customerIDText").val(); if (customerIDVal != "") { $.ajax({ url: "CallRegister2.aspx/fetchCustomerProfile", data: "{customerID:'" + customerIDVal + "'}", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data }, success: function (data) { $table = $("#existingCustomersTab").find("#profileSubTab").find("table").empty(); $table.last().append("<tr><th colspan='2'>Customer Profile</th></tr>"); $table.last().append("<tr><td>Service Provider</td><td>" + data.d[0].serviceProvider + "</td></tr>"); $table.last().append("<tr><td>Service ID</td><td>" + data.d[0].serviceID + "</td></tr>"); $table.last().append("<tr><td>First Name</td><td>" + data.d[0].firstName + "</td></tr>"); $table.last().append("<tr><td>Last Name</td><td>" + data.d[0].lastName + "</td></tr>"); $table.last().append("<tr><td>Email</td><td>" + data.d[0].email + "</td></tr>"); $table.last().append("<tr><td>Telephone</td><td>" + data.d[0].telephone + "</td></tr>"); $table.last().append("<tr><td>Street</td><td>" + data.d[0].street + "</td></tr>"); $table.last().append("<tr><td>City</td><td>" + data.d[0].city + "</td></tr>"); $table.last().append("<tr><td>State</td><td>" + data.d[0].state + "</td></tr>"); $table.last().append("<tr><td>Country</td><td>" + data.d[0].country + "</td></tr>"); $table.last().append("<tr><td>Zip</td><td>" + data.d[0].zip + "</td></tr>"); $table.last().append("<tr><td>Billing Address</td><td>" + data.d[0].billingAddress + "</td></tr>"); $table.last().append("<tr><td>Billing City</td><td>" + data.d[0].billingCity + "</td></tr>"); $table.last().append("<tr><td>Billing Zip</td><td>" + data.d[0].billingZip + "</td></tr>"); $table.last().append("<tr><td>Registered Date</td><td>" + data.d[0].regDate + "</td></tr>"); } }); } //Customer Profile Block break; default: //code to be executed if n is different from case 1 and 2 } } });
Auto Complete with ajax
$("#existingCustomersTab").find("#nameText").autocomplete({ source: function (request, response) { $.ajax({ url: "CallRegister2.aspx/fetchCustomerNames", data: "{reqNames: '" + request.term + "',lastNameChecked: '" + $("#existingCustomersTab").find('input[id=lastNameRb]:radio:checked').val() + "'}", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (data) { response($.map(data.d, function (item) { return { label: item.firstName + " " + item.lastName, value: item.firstName + " " + item.lastName, id: item.id, first: item.firstName, last: item.lastName } })) }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); }, select: function (event, ui) { $.ajax({ url: "CallRegister2.aspx/fetchCustomerDetails", data: "{txtId: '" + ui.item.id + "'}", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (data) { $("#existingCustomersTab").find("#firstHiddenText").val(ui.item.first); $("#existingCustomersTab").find("#lastHiddenText").val(ui.item.last); $("#existingCustomersTab").find("#emailText").val(data.d[0].email); $("#existingCustomersTab").find("#customerIDText").val(ui.item.id); $("#existingCustomersTab").find("#phoneText").val(data.d[0].telephone); $("#existingCustomersTab").find("#accountIDText").val(data.d[0].serviceID); $("#existingCustomersTab").find("#customerDetailsDiv").tabs("option", "selected", 0); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); }, minLength: 2, delay: 10 });
Dynamic acordian Jquery
function replyAccordion(complaintNo) { $("#existingCustomersTab").find("#ticketHistorySubTab").find("#complaintNoHidden").val(complaintNo); $.ajax({ url: "CallRegister2.aspx/fetchReply", data: "{complaintNo:'" + complaintNo + "'}", dataType: "json", type: "POST", contentType: "application/json; charset=utf-8", dataFilter: function (data) { return data; }, success: function (data) { var $div2 = $('<div/>'); var $h3 = $('<h3/>'); var $div = $('<div/>'); var $p = $('<p/>'); var $textarea = $('<TextArea/>').attr('id', 'replyTextArea').css('width', '325px'); var $select = $('<Select/>').attr('id', 'statusSelect2').append(statusStr); var $select2 = $('<Select/>').attr('id', 'repliedBySelect').append("<option value='Executive'>Executive</option><option value='Customer'>Customer</option>"); var $button = $('<Input/>').attr('value', 'Post Reply').attr('type', 'button').attr('id', 'replyButton'); $h3.append("Reply Post").append("| ComplaintNo:").append(complaintNo).append("| Status:").append(""); $p.append($textarea).append("<br />").append($select2).append($select).append($button); $div.append($p); $div2.append($h3).append($div); $.each(data.d, function (i, item) { var $h3 = $('<h3/>'); var $div = $('<div/>'); var $p = $('<p/>'); $h3.append("Replied By:").append(item.repliedBy).append("| On:").append(item.replyDate).append("| Status:").append(item.ticketStatus); $p.append(item.reply); $div.append($p); $div2.append($h3).append($div); }); $div2.accordion({ active: 0, autoHeight: false }); $("#existingCustomersTab").find("#ticketHistorySubTab").find("#ticketHistoryAccordion").empty().append($div2); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); } }); }
Pouse Resume Jquery Function
var i = 0; var intervalFunction = function () { $("#slider").find("#gallery").find("a").find("img").attr("src", arrLinks[i++].image); } var intervalID = window.setInterval(intervalFunction, 2000); $("#slider").find("#gallery").find("a").find("img").mouseover(function () { window.clearInterval(intervalID); }); $("#slider").find("#gallery").find("a").find("img").mouseleave(function () { intervalID = window.setInterval(intervalFunction, 2000); });
Subscribe to:
Posts (Atom)