Friday, June 27, 2014

Web

Request.Url 

 string url = HttpContext.Current.Request.Url.AbsoluteUri;

http://www.codepal.co.uk/show/Using_RequestUrl_to_find_specific_parts_of_the_web_pages_address
http://www.codeproject.com/Articles/87316/A-walkthrough-to-Application-State

Script

jQuery Fundamentals

http://jqfundamentals.com/legacy




<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js">
</script>


<script type="text/javascript">
alert ("js on.");
$(document).ready(function(e) {
alert ('jQuery on.');
e.preventDefault();
</script>



Session Time Out Warning Message Using jQuery in ASP.NET

http://www.codeproject.com/Articles/711196/Session-Time-Out-Warning-Message-Using-jQuery-in-A




*********************Java Script Alert from C#****************************************

 ScriptManager.RegisterClientScriptBlock(Page, this.GetType(), "FileDownload", "alert('This file does not exist.') ", true);

***************************Java Script  from C# ***********************************

 /// <summary>
    /// Show Message and redirect to Home page
    /// </summary>
    public void ShowOperatoinFailedMsg(String title)
    {
        string scriptMsg = String.Format(@"$(document).ready(function(){{
                                    ShowMessageBox('The operation has been failed. You are redirecting to home                                     page', '{0}',GoToHomePage,null,450,125);
                                    function GoToHomePage(){{
                                        window.location = '{1}';
                                    }}
                                 }});", title, this.ResolveUrl("~/users/DataCollection.aspx?MenuHome=0"));
        ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ShowMsg", scriptMsg, true);
    }

****************************Java Script   from C#*******************************
 public void ShowMessageOnLoad(String message, String title)
    {
        string scriptMsg = String.Format(@"$(document).ready(function(){{ShowMessageBox('{0}', '{1}',null,null,200,125);}});",message, title);
        ScriptManager.RegisterClientScriptBlock(this, typeof(Page), "ShowMessageOnLoad", scriptMsg, true);
    }


Wednesday, June 25, 2014

DropDownList

 <label>Advisor Compensation</label>
<asp:DropDownList CssClass="dropdown desiredPlanType" ID="ddlAdvisorCompensation" AppendDataBoundItems="true" runat="server" OnSelectedIndexChanged="ddlAdvisorCompensation_SelectedIndexChanged">
 <asp:ListItem Text="All" Value=""/> 
                        <%--<asp:ListItem Text="All" Value="All"></asp:ListItem>
                        <asp:ListItem Text="Fee-Based" Value="Fee-Based"></asp:ListItem>
                        <asp:ListItem Text="Commissioned  Based 25" Value="Commissioned  Based 25"></asp:ListItem>
                        <asp:ListItem Text="Commissioned  Based 50" Value="Commissioned  Based 50"></asp:ListItem>
                        <asp:ListItem Text="Commissioned  Based 100" Value="Commissioned  Based 100"></asp:ListItem>--%>
  </asp:DropDownList>


<%--<asp:RequiredFieldValidator ValidationGroup="Submit" ID="rfvProjectType" runat="server"
          ControlToValidate="ddlAdvisorCompensation" InitialValue="All" ErrorMessage="*"></asp:RequiredFieldValidator>--%>

 protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {            
                this.LoadAdvisorCompensation();
             }
         }


 private void LoadAdvisorCompensation()
        {
            InvestmentBO investmentBO = new InvestmentBO();
            if (investmentBO.GetAdvisorCompensation().Count() > 0)
            {
                ddlAdvisorCompensation.Items.Clear();
                ddlAdvisorCompensation.DataSource = investmentBO.GetAdvisorCompensation();
                ddlAdvisorCompensation.DataValueField = "AdvisorCompensation";
                ddlAdvisorCompensation.DataTextField = "AdvisorCompensation";
                ddlAdvisorCompensation.Items.Add("All");
                ddlAdvisorCompensation.DataBind();
            }
        }

private void FillDropdownList()
        {
            ddlAdvisorCompensation.SelectedValue = Request.QueryString["AdvisorCompensation"];        
        }

public List<InvestmentGroup> GetAdvisorCompensation()
        {
            using (var _dbCon = new FiduciaryKEntities())
            {              
var acAll = from ac in _dbCon.Database.SqlQuery<InvestmentGroup>(SQLConstants.AdvisorCompensation)
               select ac;
                return acAll.ToList();
            }
        }

 public class InvestmentGroup
    {      
        public string AdvisorCompensation { get; set; }
    }

 public static class SQLConstants
    {        
        public static string AdvisorCompensation = "SELECT distinct AdvisorCompensation FROM vw_FiduciaryK_GetInvestmentGroupName where AdvisorCompensation !='null'";
    }


DataBase

*******************************************SP*****************************
USE [TPAManager_be]
GO

ALTER Procedure [dbo].[pr_FiduciaryK_GetInvestmentGroupNameByProductId]
(
@ProductId as int,
@PortfolioLineup as varchar(100) = null,
@CoreStrategy as varchar(100) = null,
@AdvisorCompensation as varchar(100) = null
)
AS
If @PortfolioLineup = 'All'
Begin
SET @PortfolioLineup = null
End

If @CoreStrategy = 'All'
Begin
SET @CoreStrategy = null
End

If @AdvisorCompensation = 'All'
Begin
SET @AdvisorCompensation = null
End

SELECT     IG.GroupID, IG.GroupName, IG.Description, IG.CoreStrategy, IG.PortfolioLineup, IG.AdvisorCompensation
, IG.FiduciaryKQuestionnaireFile
FROM         tblInvestmentGroup AS IG INNER JOIN
                      FiduciaryK_ProductFundList AS F ON IG.GroupID = F.GroupId
WHERE f.ProductId=@ProductId
and PortfolioLineup=isnull(@PortfolioLineup, PortfolioLineup)
and CoreStrategy=isnull(@CoreStrategy, CoreStrategy)
and AdvisorCompensation=isnull(@AdvisorCompensation, AdvisorCompensation)

******************************************* *****************************

Thursday, June 12, 2014

CHTML CSS

Enable Disable Button  Using CSS


<style type="text/css">
    .action-bar.action-bar-false { position:relative; }
    .action-bar.action-bar-false .action { opacity:0.8; }
    .action-disable { display:none;}
    .action-bar.action-bar-false .action-disable { display:block; position:absolute; top:0; left:0;          width:100%; height:100%; z-index:99;}
</style>


@{
string partialstr = default(Guid) != ViewBag.parentid ? "action-bar" : "action-bar action-bar-false";
<div class="@partialstr">
<div class="action-disable"></div>
<a href="#" class="action add" title="Add Account Type"  onclick="return ShowModal('ModalpopupAddAddress','popupcontainerAddAddress','@Url.Action("AddEditView", "Address", new { parentID=ViewBag.ParentID})')"><i></i><span>Add</span></a>
</div>

}

Checkbox Checked then disable multiple DropwownList

Checkbox Checked then disable multiple DropwownList
Form load   Enable/Disable

Two DropdownList Id:
ParentId-CycleFiler
*********************************chhtml Page****************************
<script type="text/javascript">
    $(document).ready(function () {
   
        $('input[data-target]').each(function () {
            enableDisabled(this);
        })

    });

    function enableDisabled(self){
        var get_target = $(self).attr('data-target').split('-');
        if($(self).is(':checked')){
            for(var i=0;i<get_target.length;i++){
                $('#'+get_target[i]).attr('disabled','disabled');
            }
        }
        else {
            for(var i=0;i<get_target.length;i++){
                $('#'+get_target[i]).removeAttr('disabled');
            }
        }
    }
</script>

  @Html.CheckBoxFor(c => c.IsParent, new { data_target = "ParentId-CycleFiler", onChange = "enableDisabled(this)" })
            @Html.CheckBoxFor(c => c.IsParent, new { data_target = "ParentId", onChange = "enableDisabled(this)" })
 ************************************************************



           

Sunday, June 1, 2014

DotNetQuestions


Communication Skill
1.       Do you work well with other people?
2.       Tell me about yourself.
3.       What major challenges and problems did you face? How did you handle them?
4.       Describe a difficult work situation / project and how you overcame it.
5.       What have you learned from your mistakes?
6.       What was it like working for your supervisor?
7.       What do you expect from a supervisor?
8.       How do you handle stress and pressure?
9.       What has been the greatest disappointment in your life?
10.   What are you passionate about?
11.   What are your pet peeves?
12.   What do people most often criticize about you?
13.   When was the last time you were angry? What happened?
14.   Do you prefer to work independently or on a team?
15.   Give some examples of teamwork.
16.   Why are you the best person for the job?
17.   Why do you want to work here?
18.   What can you contribute to this company?
OOP Question
Beginner
1.       Explain the basic features of OOPs
2.       What is polymorphism?
3.       Difference abstraction and encapsulation?
4.       What is difference between Overloading and Overriding?
5.       What is static class and method?
6.       How can you prevent your class to be inherited further?
7.       Difference between abstract and interface
8.       Difference between class and structure
9.       What are the access modifiers?
10.   What is shadowing or hiding?
11.   Difference between Namespace and Assembly?
Intermediate
12.   What are generics?
13.   What is a delegate and event?
14.   Can we have Sealed Method in abstract class?
15.   Can we have an Abstract class without having any abstract method?
16.   Can we have Multiple Main Methods in one .cs file?
17.   What is the default access modifier of a class?
18.   How does Composition mechanism works?
Advance
19.   Can you override private virtual methods?
20.   Can you prevent your class from being inherited and becoming a base class for some other classes?
21.   Can you allow class to be inherited, but prevent the method from being over-ridden?
22.   Why can't you specify the accessibility modifier for methods inside the interface?
23.   Static data members should be initialized inside the constructor. True or False.
What are OOP designs Principles?

XML Question:
Beginner:
  1. What is the difference between SAX parser and DOM parser?
  2. What is the difference between Schema and DTD?
  3. How do you parse/validate the XML document?
  4. What is XML Namespace?
  5. What is Xpath?
  6. What is XSL?
  7. What is XSLT?
  8. Intermediate:
  9. What is the building structure of XML?
  10. How does XML differ from HTML?
  11. How do you traverse an XML?
  12. What is XML template?
  13. How would you produce PDF output using XSL’s?
  14. Advance:
  15. What is the difference between DOM parser and SAX parser?
  16. What is XML schema?
  17. What is node value and node attribute?
  18. What is purpose of CDATA?
  19. What are the steps to transform XML into HTML using XSL?

      ADO.NET
  1. Beginner:
  2. What is the namespace in which .NET has the data functionality class?
  3. Can you give an overview of ADO.NET architecture?
  4. What are the two fundamental objects in ADO.NET?
  5. What is difference between dataset and data reader?
  6. What are major difference between classic ADO and ADO.NET?
  7. What is the use of connection object?
  8. What is the use of command objects?
  9. What is the use of data adapter?
  10. What are basic methods of Data adapter?
  11. What is Dataset object?
  12. Intermediate:
  13. What are the various objects in Dataset?
  14. How can we connect to Microsoft Access, FoxPro, and Oracle etc?
  15. How do we connect to SQL SERVER, which namespace do we use?
  16. How do we use stored procedure in ADO.NET and how do we provide parameters to the stored procedures?
  17. How can we force the connection object to close after my data reader is closed?
  18. I want to force the data reader to return only schema of the data store rather than data.
  19. How can we fine-tune the command object when we are expecting a single row?
  20. Which is the best place to store connection string in .NET projects?
  21. What are the steps involved to fill a dataset?
  22. What are the various methods provided by the dataset object to generate XML?
  23. How can we save all data from dataset?
  24. How can we check that some changes have been made to dataset since it was loaded?
  25. Advance:
  26. How can we add/remove row is in “Data Table” object of “Dataset”?
  27. What is basic use of “Data View”?
  28. What is the difference between “Dataset” and “Data Reader”?
  29. How can we load multiple tables in a Dataset?
  30. How can we add relation between tables in a Dataset?
  31. What is the use of Command Builder?
  32. What’s difference between “Optimistic” and “Pessimistic” locking?
  33. How many ways are there to implement locking in ADO.NET?
  34. How can we perform transactions in .NET?
  35. What is difference between Dataset Clone and Dataset. Copy?
  36. Can you explain the difference between an ADO.NET Dataset and an ADO Record set?
  37. Explain in detail the fundamental of connection pooling?
  38. What is Maximum Pool Size in ADO.NET Connection String?
  39. How to enable and disable connection pooling?
  40. What extra features does ADO.Net 2.0 have?
Web service Question
Beginner:
  1. What is XML-RPC?
  2. What is SOAP?
  3. What is WSDL?
  4. What is UDDI?
  5. What is REST?
  6. Intermediate:
  7. How you define web service protocol stack?
  8. What kind of security is needed for web services?
  9.  Name the various communication channels in web service?
  10. What are the situations, when we need ASP.NET web services?
  11. Explain the .NET web services supported data types?
  12. Advance:
  13. Differentiate between .NET Web Services and .NET Remoting?
  14. Differentiate between Soap based Web Services and Rest based Web Services?
  15. What is MSMQ?
  16. Difference between WCF and Web service?
  17. Can we consume web service without proxy? If Answer is yes , then How it is possible?  


Restful Service

1.      What is REST and RESTful web services?
2.       What is differences between RESTful web services and SOAP web services ?
3.       What is Restlet framework?
4.       What is Resource in REST framework?
5.       Can you use Restlet without any web-container?
6.       What is difference between Restlets and Jersey?
7.       What is RESTEasy?
8.       What are the tools used for creating RESTFull web services?
9.       How to display custom error pages using RestFull web services?
10.   Which HTTP methods are supported by RestFull web services?
11.   What is difference between top-down and bottom-up approach of developing web services?
12.   What happens if RestFull resources are accessed by multiple clients? Do you need to make it thread-safe?

Database and SQL
1.       What is RDBMS?
2.       What is normalization?
3.       What are different normalization forms?
4.       What is Stored Procedure?
5.       What is Trigger?
6.       What is View?
7.       What is Index?
8.       What is cursor?
9.       What’s the difference between a primary key and a unique key?
10.   How to implement one-to-one, one-to-many and many-to-many relationships while designing tables?
11.   What is a NOLOCK?
12.   What is difference between DELETE & TRUNCATE commands?
13.   Difference between Function and Stored Procedure?
14.   When is the use of UPDATE_STATISTICS command?
15.   What types of Joins are possible with Sql Server?
16.   What is the difference between a HAVING CLAUSE and a WHERE CLAUSE?
17.   What is sub-query? Explain properties of sub-query.
18.   What are types of sub-queries?
19.   What are primary keys and foreign keys?
20.   What is data integrity? Explain constraints?
21.   What is De-normalization?
22.   Can we rewrite sub queries into simple select statements or with joins?
23.   What is Self Join?
24.   What is Cross Join?
25.   List few advantages of Stored Procedure.

MVC Question
Beginner:
1.       Explain MVC pattern?
2.       What are the advantages of ASP.NET MVC?
3.       What is Controller in ASP.NET MVC?
4.       What is View in ASP.NET MVC?
5.       What is model in ASP.NET MVC?
6.       What is Razor View Engine?
7.       What are the 2 popular asp.net mvc view engines?
8.       What symbol would you use to denote, the start of a code block in razor views?
9.       In razor syntax, what is the escape sequence character for @ symbol?
10.   Give an example for Authorization filters in an asp.net mvc application?
11.   What type of filter does OutputCacheAttribute class represents?
12.   What are the file extensions for razor views?
13.   How do you specify comments using razor syntax?
14.   What is the namespace of asp.net mvc?
15.   What is ASP.NET MVC?
16.   What is difference between ViewBag and ViewData in ASP.NET MVC?
17.   What is Routing in ASP.NET MVC?
18.   How to identify AJAX request with C# in MVC.NET?
19.   What are the 3 main components of an ASP.NET MVC application?
20.   What is the 'page lifecycle' of an ASP.NET MVC?

Intermediate:
21.   What are the ASP.NET MVC folder conventions?
22.   What is the main function of URL routing system in ASP.NET MVC?
23.   What are the namespace classes used in ASP.NET MVC?
24.   What is Repository Pattern in ASP.NET MVC?
25.   What is the page lifecycle of an ASP.NET MVC?
 
Advance:
26.   What are the different types of filters, in an asp.net mvc application?
27.   What is the use of action filters in an MVC application?
28.   What are the 2 ways of adding constraints to a route?
29.   What are three segments of the default route, which is present in an ASP.NET MVC application?
30.   What is the significance of ASP.NET routing?
31.   What is the significance of NonActionAttribute?
32.   Is it possible to share a view across multiple controllers?
33.   What is the greatest advantage of using asp.net mvc over asp.net webforms?
34.   In which assembly is the MVC framework defined?
35.   How to call JavaScript function on the change of dropdown list in ASP.Net MVC?
36.   How route table created in ASP.Net MVC?
37.   How do you avoid XSS vulnerabilities in ASP.Net (MVC)?
38.   What is repository pattern in MVC.NET?



Entity Framework



1.       What is Entity Framework?2.       Will there be any issues adding a table without primary keys to a data model?
3.       How do you truncate a table using entity data model?
4.       How do you query in entity model when the result has a join from from different database other than the entity model? E.g.: SELECT t1.c1, t2.c2 FROM table1 AS t1 JOIN table2 t2 ON t1.c1 = t2.c1
5.       What is minimum requirement for Entity Framework applications to run?
6.       What is CSDL?
7.       What is SSDL?
8.       What is MSL?
9.       What is Entity Data Model?
10.   Which are the key concepts of Entity Data Model?
11.   What is .edmx file and what it contains?
12.   How can you tell EF to have a different table or column name than that defined for the class?
13.   How do you mark a property as required? For example, For a Project, the Name is a required field.
14.   What is use of EntityDataSource Control?
15.   What is Model First Approach?
16.   What is Code First Approach?
17.   What is Entity SQL?
18.   What is LINQ To Entities?
19.   What is EntityClient?
20.   What is Deferred Loading(Lazy Loading)?
21.   What is Eager Loading?
22.   What is Complex Type?
23.   What is Conceptual Model?
24.   What is use of Entity Container?
25.   What is Explicit Loading?
26.   What do you mean by Navigation Property?
27.   What is scalar property?
28.   What is split entity?
29.   What do you mean by table-per-hierarchy?
What do you mean by table-per-type? 


WCF

1.       What are the important principles of SOA (Service oriented Architecture)?
2.       What are ends, contract, address, and bindings?
3.       Which specifications does WCF follow?
4.       What are the main components of WCF?
5.       Explain how Ends, Contract, Address, and Bindings are done in WCF?
6.       What is a service class?
7.       What is a service contract, operation contract and Data Contract?
8.       What are the various ways of hosting a WCF service?
9.       How do we host a WCF service in IIS?
10.   What are the advantages of hosting WCF Services in IIS as compared to self-hosting?
11.   What are the major differences between services and Web services?
12.   What is the difference WCF and Web services?
13.   What are different bindings supported by WCF?
14.   Which are the various programming approaches for WCF?
15.   What is one-way operation?
16.   Can you explain duplex contracts in WCF?
17.   How can we host a service on two different protocols on a single server?
18.   How can we use MSMQ bindings in WCF?
19.   Can you explain transactions in WCF?
20.   What different transaction isolation levels provided in WCF?
21.   Can we do transactions using MSMQ?
22.   Can we have two-way communications in MSMQ?
23.   What are Volatile queues?
24.   What are Dead letter queues?
25.   What is a poison message?


ASP.NET
1.       How can we identify that the Page is PostBack
2.       How does ASP.NET maintain state in between subsequent request
3.       What is event bubbling?
4.       How do we assign page specific attributes
5.       Administrator wants to make a security check that no one has tampered with ViewState, how can be ensure this?
6.       What is the use of @ Register directives
7.       What’s the use of SmartNavigation property
8.       What is AppSetting Section in “Web.Config” file ?
9.       Where is ViewState information stored ?
10.   What is the use of @ OutputCache directive in ASP.NET?
11.   How can we create custom controls in ASP.NET?
12.   How many types of validation controls are provided by ASP.NET?
13.   Can you explain what is “AutoPostBack” feature in ASP.NET?
14.   How can you enable automatic paging in DataGrid?
15.   What’s the use of “GLOBAL.ASAX” file?
16.   What is the difference between “Web.config” and “Machine.Config” ?
17.   What is the difference between Authentication and authorization?
18.   What’s difference between Datagrid, Datalist and repeater ?
19.   Does session use cookies?
20.   How can we force all the validation control to run?
21.   If client side validation is enabled in your Web page, does that mean server side code is not run?
22.   How can I show the entire validation error message in a message box on the client side?
23.   You find that one of your validation is very complicated and does not fit in any of the validators, what will you do?
24.   What is Tracing in ASP.NET?
25.   How do we enable tracing?
26.   What exactly happens when ASPX page is requested from Browser?
27.   How can we kill a user session?
28.   How do you upload a file in ASP.NET?
29.   How do I send email message from ASP.NET ?
30.   Explain the differences between Server-side and Client-side code?
31.   Can you explain Forms authentication in detail?
32.   How do I sign out in forms authentication?
33.   If cookies are not enabled at browser end does form Authentication work?
What is the difference between “Web farms” and “Web garden”?












DRY Principle – Don’t Repeat Yourself