Sunday, July 26, 2020

What is Angular ?

Angular is a Javascript Binding Framework which binds the HTML UI and Javascript Model.
This helps you to reduce your efforts on writing thos lengthy lines of code for binding.

Adding to it, it also helps you to build SPA by using the concept of routing.
It also has lot of other features like HTTP,DI,Input output because of which you do not need other frameworks.

Friday, March 10, 2017

Avoid Multiple time Submit button click event

<asp:Button ID="btnSubmit" runat="server" class="btn btn-success"  OnClick="btnSubmit_Click"
                      ValidationGroup="Submit" Text="Submit" OnClientClick="if (!Page_ClientValidate()){ return false; } this.disabled = true; this.value = 'Saving...';"
   UseSubmitBehavior="false"></asp:Button>

Thursday, January 19, 2017

Entity Framework with LINQ aggregate to concatenate string

DataTypeID, Name, DataValue
1,"Data 1","Value1"
1,"Data 1","Value2"
2,"Data 1","Value3"
3,"Data 1","Value4"


var query = (from t in context.TestData
group t by new { DataTypeID = t.DataTypeID, Name = t.Name } into g
select new { DataTypeID = g.Key.DataTypeID, Name = g.Key.Name, Data = g.AsEnumerable()})
.ToList()
.Select (q => new { DataTypeID = q.DataTypeID, Name = q.Name, DataValues = q.Data.Aggregate ("", (acc, t) => (acc == "" ? "" :
acc + ",") + t.DataValue) });

Wednesday, July 20, 2016

Maintain Scroll Position of DIV on PostBack in ASP.Net

<div id="dvScroll" style="overflow-y: scroll; height: 260px; width: 300px">
    1. This is a sample text
    <br />
    2. This is a sample text
    <br />
    3. This is a sample text
    <br />
    4. This is a sample text
    <br />
    5. This is a sample text
    <br />
    6. This is a sample text
    <br />
    7. This is a sample text
    <br />
    8. This is a sample text
    <br />
    9. This is a sample text
    <br />
    10. This is a sample text
    <br />
    11. This is a sample text
    <br />
    12. This is a sample text
    <br />
    13. This is a sample text
    <br />
    14. This is a sample text
    <br />
    15. This is a sample text
    <br />
    16. This is a sample text
    <br />
    17. This is a sample text
    <br />
    18. This is a sample text
    <br />
    19. This is a sample text
    <br />
    20. This is a sample text
    <br />
    21. This is a sample text
    <br />
    22. This is a sample text
    <br />
    23. This is a sample text
    <br />
    24. This is a sample text
    <br />
    25. This is a sample text
    <br />
</div>
<hr />
<input type="hidden" id="div_position" name="div_position" />
<asp:Button Text="Submit" runat="server" />
 
<script type="text/javascript">
window.onload = function () {
    var div = document.getElementById("dvScroll");
    var div_position = document.getElementById("div_position");
    var position = parseInt('<%=Request.Form["div_position"] %>');
    if (isNaN(position)) {
        position = 0;
    }
    div.scrollTop = position;
    div.onscroll = function () {
        div_position.value = div.scrollTop;
    };
};
</script>
 
 
 
 

Wednesday, December 23, 2015

Disply category and sub category

SELECT        TOP (100) PERCENT catName, ID, ParentMenuId, LinkPage
FROM            (SELECT        ISNULL(C.Name + '>', '') + ISNULL(B.Name + '>', '') + A.Name AS catName, A.ID, A.ParentMenuId, A.Name AS LinkPage
                          FROM            dbo.ISMenu AS A LEFT OUTER JOIN
                                                    dbo.ISMenu AS B ON A.ParentMenuId = B.ID LEFT OUTER JOIN
                                                    dbo.ISMenu AS C ON B.ParentMenuId = C.ID) AS P