My Doubts

C#

What is difference between bool and Boolean?


Dotnet Telephonic Interview Questions


SQL Server

Can we use a view in Stored Procedure?

Can we use a function in SP?

Difference between SP and a function?

Can we use stored procedure in a view?

Is there any limit for input and output parameters in Stored. If yes, how many?

What is Index?



MVC

Have you used unit testing?

How many types of view can we return?


How to use web grid in mvc?

what is aync?

what is indexer?

difference between API Controller and normal controller?

Private action can be invoked? if no, why?  Give reason?

what is NonAction attribute?



CheckBoxList Binding

Static from CS

 List<ListItem> li = new List<ListItem>();
 li.Add(new ListItem { Text = "Select", Value = "0" });
 li.Add(new ListItem { Text = "India", Value = "0" });
 li.Add(new ListItem { Text = "Pak", Value = "0" });
 li.Add(new ListItem { Text = "Ban", Value = "0" });
 li.Add(new ListItem { Text = "SL", Value = "0" });
 chkList.DataSource = li;
 chkList.DataTextField = "Text";
 chkList.DataValueField = "Value";
 chkList.DataBind();


Static from ASPX

<asp:CheckBoxList RepeatLayout="Flow" runat="server" ID="chkList" RepeatDirection="Horizontal" RepeatColumns="1" TextAlign="Right" >
<asp:ListItem Text="Select" Value="0"></asp:ListItem>
<asp:ListItem Text="India" Value="1" Selected="True"></asp:ListItem>
       <asp:ListItem Text="Pak" Value="2"></asp:ListItem>
       <asp:ListItem Text="Ban" Value="3"></asp:ListItem>
       <asp:ListItem Text="SL" Value="4"></asp:ListItem>
       <asp:ListItem Text="Nepal" Value="5"></asp:ListItem>
</asp:CheckBoxList>



Dynamic Binding

                         //dt is the DataTable obtained from SQL Server using ADO.NET
               chkList.DataSource = dt;
               chkList.DataTextField = "EmpName";
               chkList.DataValueField = "ID";
               chkList.DataBind();



Insert or ADD
                chkList.Items.Insert(0, new ListItem { Text = "Select", Value = "0" });
                chkList.Items.Insert(1, new ListItem { Text = "India", Value = "1" });
                chkList.Items.Insert(2, new ListItem { Text = "Pak", Value = "2" });
                chkList.Items.Insert(3, new ListItem { Text = "Ban", Value = "3" });
                chkList.Items.Insert(4, new ListItem { Text = "SL", Value = "4" });
                chkList.Items.Insert(5, "AFG");
                chkList.Items.Add("Australia");
                chkList.Items.Add(new ListItem { Text = "NZ", Value = "5" });




Repeat Layout:
1.  Flow
2.  Table
3.  Ordered List
4.  Unordered List


1.       Flow

  <span id="Span1">
        <input id="chkList_0" type="checkbox" name="chkList$0" value="0">
        <label for="chkList_0">Select</label><br>

        <input id="chkList_1" type="checkbox" name="chkList$1" checked="checked" value="1">           <label for="chkList_1">India</label><br>

        <input id="chkList_2" type="checkbox" name="chkList$2" value="2">
        <label for="chkList_2">Pak</label><br>

        <input id="chkList_3" type="checkbox" name="chkList$3" value="3">
        <label for="chkList_3">Ban</label><br>

        <input id="chkList_4" type="checkbox" name="chkList$4" value="4">
        <label for="chkList_4">SL</label><br>

        <input id="chkList_5" type="checkbox" name="chkList$5" value="5">
        <label for="chkList_5">Nepal</label><br>
  </span>



2.       Table

    <table id="Table1">
            <tbody>
                <tr>
                    <td>
                        <input id="chkList_0" type="checkbox" name="chkList$0" value="0">                             <label for="chkList_0">Select</label></td>
                </tr>

                <tr>
                    <td>
                        <input id="chkList_1" type="checkbox" name="chkList$1" checked="checked" value="1">
                        <label for="chkList_1">India</label></td>
                </tr>

                <tr>
                    <td>
                        <input id="chkList_2" type="checkbox" name="chkList$2" value="2">                             <label for="chkList_2">Pak</label></td>
                </tr>

                <tr>
                    <td>
                        <input id="chkList_3" type="checkbox" name="chkList$3" value="3"><label for="chkList_3">Ban</label></td>
                </tr>
                <tr>
                    <td>
                        <input id="chkList_4" type="checkbox" name="chkList$4" value="4"><label for="chkList_4">SL</label></td>
                </tr>
                <tr>
                    <td>
                        <input id="chkList_5" type="checkbox" name="chkList$5" value="5">                             <label for="chkList_5">Nepal</label></td>
                </tr>
            </tbody>
        </table>




3.   Ordered List

Error: The Unordered List and Ordered List layouts only support vertical layout.

Hence, we need to change the RepeatDirection="Vertical".

  <ol id="chkList">
            <li>
                <input id="chkList_0" type="checkbox" name="chkList$0" value="0">
                <label for="chkList_0">Select</label></li>

            <li>
                <input id="chkList_1" type="checkbox" name="chkList$1" checked="checked" value="1">
                <label for="chkList_1">India</label></li>


            <li>
                <input id="chkList_2" type="checkbox" name="chkList$2" value="2">
                <label for="chkList_2">Pak</label></li>


            <li>
                <input id="chkList_3" type="checkbox" name="chkList$3" value="3">
                <label for="chkList_3">Ban</label></li>


            <li>
                <input id="chkList_4" type="checkbox" name="chkList$4" value="4">
                <label for="chkList_4">SL</label></li>


            <li>
                <input id="chkList_5" type="checkbox" name="chkList$5" value="5">
                <label for="chkList_5">Nepal</label></li>

        </ol>





4.  Unordered Lists:

<ul id="Ul1">
            <li>
                <input id="chkList_0" type="checkbox" name="chkList$0" value="0">
                <label for="chkList_0">Select</label></li>


            <li>
                <input id="chkList_1" type="checkbox" name="chkList$1" checked="checked" value="1">
                <label for="chkList_1">India</label></li>


            <li>
                <input id="chkList_2" type="checkbox" name="chkList$2" value="2">
                <label for="chkList_2">Pak</label></li>


            <li>
                <input id="chkList_3" type="checkbox" name="chkList$3" value="3">
                <label for="chkList_3">Ban</label></li>


            <li>
                <input id="chkList_4" type="checkbox" name="chkList$4" value="4">
                <label for="chkList_4">SL</label></li>


            <li>
                <input id="chkList_5" type="checkbox" name="chkList$5" value="5">
                <label for="chkList_5">Nepal</label></li>


        </ul>