2011-07-01 5 views

答えて

1
protected void grvExpirations_RowDataBound(object sender, GridViewRowEventArgs e) 
    { 
     if (e.Row.RowType == DataControlRowType.DataRow) 
    { 
     int test = Convert.toInt32(e.Row.Cells[5].Text); 

    } 
    } 
0

使用この下のコード、

protected void grvExpirations_RowDataBound(object sender, GridViewRowEventArgs e) 
    { 
     if (e.Row.RowType == DataControlRowType.DataRow) 
     { 
      int test = Convert.ToInt32(Server.HtmlDecode(e.Row.Cells[5].Text.Trim())); 
     } 
    } 

と覚えてくださいセルインデックス番号を使用すると、上記の方法を使用している場合は、セル[5の値を取得します0

0

から始まります]最後の行のみ。
特定の行に固有の場合は、他のgridviewイベントハンドラから値を取得できると思います。

4
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { 
     if(e.Row.RowType == DataControlRowType.DataRow) 
     { 
      string LinkText = (string)System.Web.UI.DataBinder.Eval(e.Row.DataItem, "RegistrationLinkText"); 
      if(LinkText == "text") 
      { 
       e.Row.Cells[3].Text = "your text"; 
      } 
     } 
    } 
関連する問題