programming we consider all important topic for knowledge about controls,web Services, JSON, Ajax, database, and interview related Question. In this and sql server tutorial blog we give many examples of jquery as like How Play YouTube Video in Your Website by URL, How to Play YouTube Videos in by using Jquery , Jquery Change div background on mouseover in , JQuery UI Datepicker (Calendar) etc.

Thursday, January 29, 2015

How to work in with rowdata bound with grid view

How to work in grid view Rowdatabound:

In this Post i want describe about few tips and tricks in rowdatabound event which is available in gridview control and these tips will provide the solution for all possible requirements when working with rowdatabound event in gridview control.

Gridview control:

Gridview control is most common control in all applications to display the data and it’s very powerful control and lot of built in features. In this article, i will explore some tips and tricks in rowdatabound event in gridvew control, Actually RowDatabound event will occur when data row is bound to the control in the gridview control.

RowDatabound Event of Gridview Control:

First we take an ASP.NET GRID Control
<asp:GridView ID="GRDSample" runat="server" AutoGenerateColumns="false" OnRowDataBound="GRDSample_RowDataBound">
                <asp:TemplateField HeaderText="Userprofile">
                        <asp:Label ID="lblText" runat="server" Text='<%# Eval("catgryName") %>'

In this we take  lable control in grid control.

Know we want to create event by C# code on .aspx.cs page

protected void GRDSample_RowDataBound(object sender, GridViewRowEventArgs e)
            DataRowView drview = e.Row.DataItem as DataRowView;
            if (e.Row.RowType == DataControlRowType.DataRow)
                Label lblText       = e.Row.FindControl("lblText") as Label;

We can able to do formatting a specific row in a gridview based on some conditions. For this view next post.RowDataBound event in a GridView to highlight the rows by condition

Grid view Related Other Post :

No comments:

Post a Comment