public partial class WebForm1 : System.Web.UI.Page { DataContext sqlContext = new DataContext(); protected void Page_Load(object sender, EventArgs e) { var _Agent = from c in sqlContext.Agents select c; GridView1.DataSource = _Agent; GridView1.DataBind(); } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { DataRowView dRowView = (DataRowView)e.Row.DataItem; if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.RowState & DataControlRowState.Edit) > 0) { RadioButtonList _rblGender = (RadioButtonList)e.Row.FindControl("rblGender"); _rblGender.SelectedValue = dRowView[3].ToString(); } } } }
public partial class WebForm1 : System.Web.UI.Page { DataContext sqlContext = new DataContext(); protected void Page_Load(object sender, EventArgs e) { var _Agent = from c in sqlContext.Agents select c; GridView1.DataSource = _Agent; GridView1.DataBind(); } protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { DataRowView dRowView = (DataRowView)e.Row.DataItem; if (e.Row.RowType == DataControlRowType.DataRow) { if ((e.Row.RowState & DataControlRowState.Edit) > 0) { RadioButtonList _rblGender = (RadioButtonList)e.Row.FindControl("
rblGender
"); _rblGender.SelectedValue = dRowView[3].ToString(); } } } }
Line 28: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)Line 29: {Line 30: DataRowView dRowView = (DataRowView)e.Row.DataItem;Line 31: if (e.Row.RowType == DataControlRowType.DataRow)Line 32: {