Wednesday, 28 November 2012

.Net Interview Question(3_ Yeras Experience)

Some interview questions

  1. Can we call base class method in child class? No
  2. what is private constructor?
  3. difference b/w clustered and non clustered index, can we create non-clustered index without clustored index?
  4. how do get view state on other page?
  5. difference b/w interface and abstract class?
  6. How many ways we can implement interface?
  7. difference b/w read only and constant?
  8. what is data contract in WCF?
  9. How to implement security in you web application?
  10. how to implement security in WCF?
  11. What are the new features in c# 4.0, asp.net 4.0 and SQL server 2012?
  12. what is asp.net page life cycle?
  13. What is application and connection pooling?
  14. difference b/e finalize and dispose method?
  15. Garbage collector life cycle or generation?
  16. what is static class?
  17. difference b/w Ienumrable and IQuariable-LINQ
  18. what do they do Skip(), skipWhile(), take(),and takeWhile() methods-LINQ?
  19. difference b/w stored procedure and user function
  20. difference b/w delete, drop and truncate?
  21. what is delegate what is its use?
  22. difference b/w delegate and function pointer?
  23. when do we need transport security and when does message security in WCF?
  24. Example of joins in LINQ?
These question are not copy from any website, this is collected from my personal experience faced in different interview Like - Globallogic, CMC, Helm360, Ebix etc.
Please search all these answers on google
Thanks

Thursday, 8 November 2012

Textbox based autocomplete gridview search in Contentpage of ASP.net(Gridview Searching)

 Searching in gridview on during typing in textbox (Like Autoconplete)

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="GridviewSearch._Default" %>
<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>

<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<script src="Scripts/jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script language="javascript" type="text/javascript">

$(document).ready(function () {
$('#MainContent_txtSearch').keyup(function () {

$("#MainContent_GridView1 tr:has(td)").hide();
var iCounter = 0;
//Get the search box value
var sSearchTerm = $('#MainContent_txtSearch').val();
//if nothing is entered then show all the rows.
if (sSearchTerm.length == 0) {
$("#MainContent_GridView1 tr:has(td)").show();
// Reset the bacgroud color of previously searched data
$("#MainContent_GridView1 tr:has(td)").children().each(function () {
$(this).css('color', 'black');
}); return false;
} //Iterate through all the td.

$("#MainContent_GridView1 tr:has(td)").children().each(function () {
var cellText = $(this).text().toLowerCase();
//Check if data matches
if (cellText.indexOf(sSearchTerm.toLowerCase()) >= 0) {
$(this).parent().show();
$(this).css('color', 'blue');
iCounter++; return true;
} else {
$(this).css('color', 'black');
return true;
}
});
$(
'#MainContent_Label1').text('Record(s) ' + iCounter + ' found.');
}
);

});
</script>
<h2>
Welcome to ASP.NET! </h2>
<p>
To learn more about ASP.NET visit
</p>
<p>
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>
<asp:Button ID="btnSearch" runat="server" Text="Search" OnClientClick="return false;" />
</p>
<p>
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</p>
</asp:Content>

In jquery script i have used Main_Content word with every controls ID, Actually When I am using controls in side the content placeholder at run time every controls id will be concatinated  with this word.

This is the page load even of code behind which is just binding my grid, customize it acordingly-
protected void Page_Load(object sender, EventArgs e)
{ if (!IsPostBack)
{ string connectionString = ConfigurationManager.ConnectionStrings["ApplicationServices"].ConnectionString;
DataTable dt = new DataTable();
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand("Select * from Albums;", con);
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
Label1.Text =
"Record(s) " + dt.Rows.Count + " found.";
}
}