這表明當點擊<a href="" />
患者詳細信息頁面(錨標記裏面中繼器):查詢字符串值網頁提交後失去
function showPatient(Pid) {
RedirectToPage("Patient_Registration.aspx","pid="+Pid);
return false;
}
<asp:Repeater ID="repeaterPatientList" runat="server" OnItemDataBound="repeaterPatientList_ItemDataBound" >
<ItemTemplate>
<a href="#" onclick="return showPatient('<%#Eval("PID") %>')"><%#Eval("Patient_Name")%></a>
</ItemTemplate>
</asp:Repeater>
我越來越pID
爲患者詳細信息頁面上的查詢字符串。在第一頁加載後得到pID
後,患者信息被填充到相應的文本字段中。但是,當我點擊保存按鈕pID
丟失 - 獲取0作爲值,以便插入查詢總是會觸發。
int pID;
protected void Page_Load(object sender, EventArgs e)
{
pID = Convert.ToInt32(Request["pid"]);
if (pID != 0)
{
if (IsPostBack == false)
{
FillPatientInfo(pID);
}
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
if(pID ==0)
{
//insert query code
}
else
{
//update query code
}
}
。重定向任何地方的代碼? – 2012-04-25 11:54:23