Click here to Skip to main content
15,906,574 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
C#
protected void gdvDataQualityReport_RowCommand(object sender,          GridViewCommandEventArgs e)
      {
              if (e.Row.RowType == DataControlRowType.DataRow)
              {
                  LinkButton link = e.Row.FindControl("LinkButton1") as LinkButton;
                  link.Attributes["onclick"] = "return popwin(" + ((DataAvailabilityEntity)e.Row.DataItem).SourceTableName + ")";
              }
          }

this is the code which i wrote to open a pop up window while clicking on my gridview's link button.but its giving eror saying GridViewCommandEventArgs e does not contain a definition for Row.

can anyone pls help me in resolving this.

Many Thanks,
Amal
Posted
Updated 29-Aug-12 1:30am
v2
Comments
_Amy 29-Aug-12 7:40am    
Here you are telling Row Bound but using Row Command. Check it.

Yes, GridViewCommandEventArgs e does not contain a definition for Row. Try doing the same in RowDataBound Event of GridView.


--Amit
 
Share this answer
 
v2
If you are searching your control in all Rows then you should use OnRowDataBound event of GridView this method takes GridViewRowEventArgs as a parameter with Object.
C#
protected void gridview_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
  if (e.Row.RowType == DataControlRowType.DataRow)
   {
          //do your stuff.
   }
}

Hope it will help you.
Good luck.
--Rajesh
 
Share this answer
 
v2

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