gridview 找控件

 

protected void grv_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        
if(e.Row.RowType==DataControlRowType.DataRow)

        {
            
string id= grv.DataKeys[e.Row.RowIndex].Value.ToString();
            ImageButton img 
= (ImageButton)e.Row.FindControl("img");
            img.Attributes.Add(
"onmouseover""showPanel(" + id + ")");
            img.Attributes.Add(
"onmouseout""hidePanel(" + id + ")");
         
        }
        

    }

 

 

 

protected void grv_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        
string str = ((TextBox)grv.Rows[e.RowIndex].FindControl("type")).Text.ToString();
        
string id = grv.DataKeys[e.RowIndex].Value.ToString();
        bnews.updateNewsType(str, id);
        grv.EditIndex 
= -1;
        grvBind();
        JS.Alert(Page, 
"新闻类型更新成功!");
    } 


posted on 2009-05-20 22:57  seaven  阅读(199)  评论(0)    收藏  举报

导航