开发者

Error NewSelectedIndex

hey getting a error for NewSelectedIndex any one able to help?:

        protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {
        string PhotoPath = "";
        GridViewRow row = GridView1.Rows[e.NewSelectedIndex];

        PhotoPath = row.Cells[5].Text;
    }

'System.EventArgs' does not contain a definition for 'NewSelectedIndex' and no extension method 'NewSelectedIndex' accepting a first argument of type 'System.EventArgs' could be found (are you missing a using directive or an assembly reference?开发者_运维百科)48 NapierLecturer


Since the EventArgs (e) does not contain a method by the name of NewSelectedIndex (nor are there any extension methods for EventArgs named NewSelectedIndex) the error was thrown. What I think you want is to get the new selected index of the GridView control, which can be done by the code shown below.

  protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) 
{ 
    string PhotoPath = ""; 
    GridViewRow row = GridView1.Rows[GridView1.SelectedIndex]; 


PhotoPath = row.Cells[5].Text;


} 
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜