我有一個表tblProfile,它包含帶有Id,Name,Address的字段。我有2個aspx頁面,它們是Home.aspx和Here.aspx。在我Home.aspx我已經使用這個代碼傳遞的Id在我Here.aspx:查詢字符串到文本框
<asp:HyperLink ID="link" runat="server" NavigateUrl="Here.aspx?id={0}"
Font-Names="Times New Roman" Font-Size="Medium" >Click here</asp:HyperLink>
在後面的代碼Home.aspx.cs:
protected void Page_Load(object sender, EventArgs e)
{
string bID = Request.QueryString["Id"];
if (string.IsNullOrEmpty(Id))
{
Response.Redirect("Here.aspx?", true);
}
ViewState["Id"] = Id;
link.NavigateUrl = String.Format(link.NavigateUrl, Id);
}
我沒有任何問題在第二頁將Id傳遞給url。但我現在想要的是,在我的Here.aspx中,我有3個文本框,它們應該由來自Home.aspx的特定Id的Id,Name和Address填充。嘗試了很多,但沒有運氣。任何幫助,將不勝感激。順便說一句,我用c#使用asp.net。
你如何在你的'Here.aspx'頁面加載名字和地址?通過檢索數據庫或從'Home.aspx'頁面? – sarwar026
你已經嘗試寫代碼,並讓我們知道你有什麼問題,當你嘗試... –
你想發送名稱,地址爲Here.aspx,如果是這樣,嘗試像這樣點擊這裏 asp:HyperLink> –
MahaSwetha