Friday 29 November 2013

How to set MVC kendo UI grid row cell background colour?


In this article I will how to set MVC kendo ui grid row cell background colour.

First we need to identity which column colour you want change.

See the below code for MVC KENDO UI grid row cell background colour.

function dataBound1(e) {
                        var i = 0;
                        dataView = this.dataSource.view();
if (dataView[i].bomc != dataView[i + 2].bomc) {
                                var uid = dataView[i].uid;
                                var uid1 = dataView[i].bomc;
                                var colName = $('#grid').find('th').eq(7).text()
                                $("#grid tbody").find("tr[data-uid=" + uid + "]").find("td:eq(" + 7 + ")").css("background-color", "yellow");
                            }
}

Wednesday 27 November 2013

How to give colour to grid view row in Kendo UI



In this article I will explain how to give colour to grid view row in Kendo UI

First we can identify dataview length; based on the length we can give colour to grid view row

if (dataView.length > 0) {
                            var k = 0;
                            for (k = 0; dataView.length > k; k++) {
                                var uid = dataView[k].uid;
                                $("#grid tbody").find("tr[data-uid=" + uid + "]").css("background-color", "Yellow");

                            }
                        }

C# - How do I round a decimal value to 2 or more decimal places (for output on a page?)



In this article I will explain how I do round a decimal value to 2 or more decimal places.

Do round a decimal value to 2

string PART= Convert.ToDecimal(dtList.Tables[0].Rows[dr]["value"]).ToString("#.##");

If you have 0.00 values, its returns empty. To overcome this problem writes below syntax.

 string PART= Convert.ToDecimal(dtList.Tables[0].Rows[dr]["value"]).ToString("0.##");

Do round a decimal value to more than 2

string PART= Convert.ToDecimal(dtList.Tables[0].Rows[dr]["value"]).ToString("0.###");

string PART= Convert.ToDecimal(dtList.Tables[0].Rows[dr]["value"]).ToString("0.####");

How to clear dropdown list and Date picker selected data in Kendo ui


In this article I will explain how to clear dropdown list and Date picker selected data in Kendoui.
Dropdown list selected data clear

When I changed Date picker data on that time dropdown list selected data will be clear.

@(Html.Kendo().DatePicker().Name("StartDate").Format("{0:MM/dd/yyyy}")
                    .Events(e =>
                        {
                            e.Change("ChangeInDate");
                        }
                        )
                )

Below function is useful for clear dropdown list selected data  

function ChangeInDate(e) {
                        $("#ddlMonths").data("kendoDropDownList").select(0)
                        $("#ddlWeeks").data("kendoDropDownList").select(0)
                        var grid = $("#grid").data("kendoGrid");
                        grid.dataSource.read();
                    }

Date picker selected data clear

Monday 4 November 2013

Saving a record in the Database using XML


In this articel i will explain how we will save a record in the data base when the record is sent in xml format from front end using stored procedure
First take a new stored procedure. When we take a new stored procedure we will get the following default document

How to create Dynamic QR Code using ASP.NET



In this article I will explain how to create Dynamic QR Code using ASP.NET

Definition:

It is a machine-readable code consisting of an array of black and white squares, typically used for storing URLs or other information for reading by the camera on a smartphone.

Below Datalist designing code is useful for binding QR Code images.

<asp:DataList Width="100%" CellSpacing="0" ItemStyle-Width="190px" runat="server"
 ID="dlLevel2" RepeatColumns="7" DataKeyField="ID" GridLines="None" RepeatDirection="Horizontal">
               <ItemTemplate>
                  <center>
                    <div>
                      <asp:Label ID="Image1" Text='<%#bind("ID") %>' runat="server" />
                    </div>
                    <div style="height: 100px; vertical-align: text-top; width: 120px">
                   <asp:Image ID="img1" ImageUrl=' <%# DataBinder.Eval(Container.DataItem, "QRImage") %>'
                                                runat="server" Width="80px" />
                     </div>
                 </center>
              </ItemTemplate>
</asp:DataList>

How to export ASP.Net Web Page to PDF



In this article I will explain how to export ASP.Net web page to PDF.

First, you will need to download ITextsharp and add its reference to your project. ITextsharp is a free HTML to PDF Library. You can download it using the following link.

http://sourceforge.net/projects/itextsharp/

The HTML markup of the page contains a sample page with an image, some text and an HTML table. Also there’s an Export PDF button on click of which we will export the page to PDF.