我正在使用以下 C# 代码使用 stringbuilder 填充 div,我想获取单击的特定学生的 studentid。
PSC.Data.SQLDB.SQLDBHelper objReg = null;
DataSet objRegDetails = null;
try
{
objReg = new PSC.Data.SQLDB.SQLDBHelper();
objRegDetails = new DataSet();
objRegDetails = objReg.ExecuteDataSet("ListConsultants", retXML);
if (objRegDetails != null)
{
if (objRegDetails.Tables.Count > 0)
{
if (objRegDetails.Tables[0].Rows.Count > 0)
{
for (int i = 0; i < objRegDetails.Tables[0].Rows.Count; i++)
{
strRep = "<div style='width :70px;height :90px; float :left ;'><div style='width :70px; height :70px; float :left ;'>";
strRep += "<input type=\"hidden\" id=\"hdcid\" name=\"" + objRegDetails.Tables[0].Rows[i]["CName"] + "\" value=\"" + objRegDetails.Tables[0].Rows[i]["ConsultantId"] + "\">";
strRep += "<a href='a1.asp?hdcid=<%=hdcid.Value %>'>";
strRep += "<img src='../Images/Consultant/defaultimage.png' style='width:70px; height:70px;float:left;'></a></div>";
strRep +="<div style='width :70px; height :20px; float :left ;' class='pageRegText'>";
strRep += objRegDetails.Tables[0].Rows[i]["CName"].ToString();
//Session["ConsultantId"] = objRegDetails.Tables[0].Rows[i]["ConsultantId"].ToString();
strRep += "</div>";
strRep += "<div style='width :70px; height :20px; float :left ;'></div>";
strRep += "</div>";
divmain.InnerHtml += strRep;
}
}
}
}
}
catch (Exception exc)
{
}
finally
{
objRegDetails = null;
objReg = null;
}
问题:如何在点击链接标签时获取另一个页面中的隐藏字段值?