Click here to Skip to main content
15,880,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi .i want to find the gridview Id in RowDataBoundevent.how can i find please tell me anyone urgent
Posted
Comments
rahkan 7-Jan-13 7:51am    
what exactly are you trying to do?

1 solution

You will have a defined RowDataBound handler for a given grid. You should know the Grid ID at all time as the event for a given grid will be called only when you trigger the DataBind event.

This event is for handling row level feature, example:
C#
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {
        if(e.Row.RowType == DataControlRowType.DataRow)
        {
            Decimal Price = (decimal)DataBinder.Eval(e.Row.DataItem, "Price");
            if(Price<20)
            {
                e.Row.ForeColor = System.Drawing.Color.Red;
                e.Row.BackColor = System.Drawing.Color.Black;
            }
        }
    }
 
Share this answer
 
Comments
Bitto kumar 7-Jan-13 7:57am    
i have two gridviews and it has dropdownlist,i need to display details based on clicking on gridview,let us assume when gridview1 is clicked then students details has to bind ,when click on gridview2 parents details bind to dropdownlist.so in rowdatabound event i want to find which gridview is clicked by user based on that i will bind data to dropdownlist

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900