Question : gridview on row data bound

Hi i have the line of code below but have an error non-onvocable member.

Please help

Thanks,

R8VI
1:
mysds.SelectParameters[0].DefaultValue =e.Row.DataItem("VD");

Answer : gridview on row data bound

Use DataItem.Eval() method to get value of VID column of current row in grid view. First parameter is current row's DataItem object and the second parameter is the column name.

Error raised because, e.Row.DataItemIndex is an object and not a Method to call and pass column name to get value. So Use following sample code:

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
protected void gridviewoutside_RowDataBound(object sender, GridViewRowEventArgs e) 
    { 
        if (e.Row.RowType == DataControlRowType.DataRow) 
        { 
            SqlDataSource mysds = (SqlDataSource)FindControl("SqlDataSource7"); 
 
            mysds.SelectParameters[0].DefaultValue = DataBinder.Eval(e.Row.DataItem, "VID"); 
                 
        } 
 
    }
Random Solutions  
 
programming4us programming4us