I'm trying to get the username from a grid so I can get the profile. I have to do this before the grid is created. I have tried this but get "Index out of range". I have datakeynames set to username.
protected void gridUser_RowDataBound(object sender, GridViewRowEventArgs e)
string userName = gridUser.DataKeys[e.Row.RowIndex].Value.ToString();
Label lblCustomerName = (Label)gridUser.Rows[e.Row.RowIndex].FindControl("lblCustomerName");
lblCustomerName.Text = Profile.GetProfile(userName).FirstName;
View Complete Post