这是我拥有的代码,它与可见列完美配合。但是,我需要能够获取某些不可见列的值:
protected void btnSearchForSchedules_Click(object sender, EventArgs e)
{
var ds = new DataSet();
var schedulesTable = new DataTable();
foreach (GridViewRow gvr in gvShows.Rows)
{
if (gvr.RowType == DataControlRowType.DataRow)
{
if (((CheckBox) gvr.FindControl("cbSelect")).Checked)
{
string baseURL = WebConfigurationManager.AppSettings["SchedulesAPI"];
string dataSource = gvr.Cells[1].Text;
string showId = gvr.Cells[2].Text; //this column is hidden so I'm getting a NULL here
string episodeId = gvr.Cells[4].Text;
string callingURL = baseURL + "?datasource=" + dataSource + "&showid=" + showId;
if (episodeId != " ")
{
callingURL = callingURL + "&episodeId=" + episodeId;
}
schedulesTable = Transporter.GetDataTableFromAPI(callingURL);
ds.Tables.Add(schedulesTable);
}
}
}
谁能向我解释我将如何做到这一点:
字符串 showId = gvr.Cells[2].Text;
如果该列不可见?