我想在Asp.net頁面中動態創建一個鏈接。在Asp.net頁面中創建一個動態鏈接
這裏是我的aspx代碼:
<a href='<%# String.Format("LeadInformation.aspx?refNo={0}&imgpath={1}",refno[0],imgpath[0]) %>'>
Aspx.cs代碼:
public String[] imgpath = new string[8];
public String[] refno = new String[8];
protected void Page_Load(object sender, EventArgs e){
imgpath[0] ="some path";
refno[0] = "some refno";
....
}
這種方式是不是爲我工作。請幫我指定refNo = {0} & imgpath = {1}來創建鏈接。謝謝。
他們是真正的陣列,或簡單的字符串?我猜想他們是簡單的字符串,在這種情況下,你應該將'string []'改爲'string',並且失去整個'= new ...'部分。然後,在aspx代碼中,刪除括號和索引。 – SimpleVar