返回首页

我试图创建一个在GridView中删除的行...

采用三层...
我在此获得GridView的科目编号线的错误。

<pre lang="c#">

 

GridViewRow row = (GridViewRow)GridView1.Rows[e.RowIndex];

        Label Username = (Label)row.FindControl("UserName"); // problem in these lines..pls give me any alternate of that to sort out my problem

       

 



        // instantiate BAL

        Businesslayer pBAL = new Businesslayer();

        try

        {

            pBAL.Delete(Username);

 

            lblMessage.Text = "Record Deleted Successfully.";

        }

        catch (Exception ee)

        {

            lblMessage.Text = ee.Message.ToString();

        }

        finally

        {

            pBAL = null;

        }

 

       // GridView1.EditIndex = -1;

        // Refresh the list

        BindGrid();

    }

错误的是..

{C}
Error	2	Argument '1': cannot convert from 'System.Web.UI.WebControls.Label' to 'string'	

帮助我理清问题..
我怎么能访问特定列的值是字符串类型的基础上,我可以删除整行......| farooqspecials

回答