我在这个小代码中做错了什么
Page1:`
protected void GridView1_OnRowDataBound(object sender, GridViewRowEventArgs e)
{
UserType = DDlUserType.SelectedItem.Text;
if (e.Row.RowType == DataControlRowType.DataRow)
{
// Get the value in the hyperlink column.
string HyperLinkValue = e.Row.Cells[1].Text;
HyperLink myLink = new HyperLink();
myLink.NavigateUrl = "~/ShowMMBProfileStats1.aspx?Profile_ID={0}";
myLink.Text = HyperLinkValue;
}在ShowMMBProfileStats1.aspx中
protected void Page_Load(object sender, EventArgs e)
{
int MMBProfileID = Convert.ToInt32(Request.QueryString[0]);
}它给了我一个错误
输入字符串格式不正确。
在aspx页面中,我将分配datakeynames="Profile_ID"
我怎样把这个Profile_ID送到page1。‘谢谢孙
发布于 2011-06-20 23:25:32
尝试以下几点:
myLink.NavigateUrl =
"~/ShowMMBProfileStats1.aspx?Profile_ID=" + e.Row.Cells[profileIDCellIndex].Text;发布于 2011-06-20 23:30:32
您没有为{0}设置值。试着做这样的事情:
myLink.NavigateUrl =
String.Format("~/ShowMMBProfileStats1.aspx?Profile_ID={0}", HyperLinkValue );或
myLink.NavigateUrl = "~/ShowMMBProfileStats1.aspx?Profile_ID=" + HyperLinkValue ;https://stackoverflow.com/questions/6418668
复制相似问题