【发布时间】:2013-06-15 07:03:27
【问题描述】:
这是我拥有的代码,它与可见列完美配合。但是,我需要能够获取某些不可见列的值:
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;
如果该列不可见?
【问题讨论】:
-
我看到了另一个问题,但我不明白如何让它在我的代码中工作。