我有一个指向传递JobID的页面的链接,但我也想传递一个类型字符串。然后,如果将此类型的字符串传递给函数,请运行if语句。
e.Row.Cells[index].Text = "<a rel=\"shadowbox\" href=\"utilities/DocketViewer.aspx?JobID=" + SerNo.JobID + "\"><img src=\"images/icons/buttons/basic1-006-small.png\" alt=\"" + SerNo.JobNo + "\" title=\"" + SerNo.JobNo + "\" type=dbrief\"" + "\"/></a>";
在链接将我发送到的页面上,我要运行这样的if语句。但是唯一传递的QueryString是JobID,因此它不会放入if语句中。
if (Request.QueryString["type"] == "dbrief")
{
}
我该如何传递另一个价值?
您需要像这样在href中添加更多内容
e.Row.Cells[index].Text = "<a rel=\"shadowbox\" href=\"utilities/DocketViewer.aspx?JobID=" + SerNo.JobID + "&type=dbrief"\"><img src=\"images/icons/buttons/basic1-006-small.png\" alt=\"" + SerNo.JobNo + "\" title=\"" + SerNo.JobNo + "\" type=dbrief\"" + "\"/></a>";
您似乎有一个简短的常识。如果这是SerNo上的一个字段,那么您会做
e.Row.Cells[index].Text = "<a rel=\"shadowbox\" href=\"utilities/DocketViewer.aspx?JobID=" + SerNo.JobID + "&type=" + SerNo.dBrief + "\"><img src=\"images/icons/buttons/basic1-006-small.png\" alt=\"" + SerNo.JobNo + "\" title=\"" + SerNo.JobNo + "\" type=dbrief\"" + "\"/></a>";
编辑:当我们在使用它时,您可以使用string.Format使其不那么混乱
e.Row.Cells[index].Text = string.Format("<a rel=\"shadowbox\" href=\"utilities/DocketViewer.aspx?JobID={0}&type=dbrief\"><img src=\"images/icons/buttons/basic1-006-small.png\" alt=\"{1}\" title=\"{1}\" type=\"dbrief\"/></a>", SerNo.JobID, SerNo.JobNo);
标题/类型后面的语音标记似乎也有误。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句