looking for some solutions? You are welcome.

SOLVED: how to read a all rows in a specific column and change before binding in grid view asp.net

Sravani Chinta:

I have a sql Table where it contains one column all hexabinary values. While retrieving the data from the table in a grid view .I need to change all its value in a particular column with and then binding.

foreach (DataRow dr in ds.Tables[0].Rows)
        {
            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                object o = dr["ColumnName"];
                if (o != DBNull.Value) // Check for null
                {

                    if (ds.Tables[0].Rows[i]["ColumnName"].ToString() != null)
                    {
                        ds.Tables[0].Rows[i]["ColumnName"] = value.ToString();
                    }
                    else
                    { }
                }
            }
        }
ds.Tables[0].AcceptChanges();
grid.DataSource = ds;
                grid.DataBind();

I am trying to loop through only one particular column and change all the values in that.But it is failing.please help me



Posted in S.E.F
via StackOverflow & StackExchange Atomic Web Robots
Share:

No comments:

Recent