그것이여기에 ~
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
}
}
내가 이상한가
편집 결과를 얻고 같은 사용자 제어 Page_Load 이벤트에 Page.IsPostBack을 확인하는 것이 좋습니다 제어하는 것입니다. 기본 폼이로드 될 때 Request.QueryString을 사용하여 고객 ID를 가져온 다음 SESSION 변수에 배치합니다.
컨트롤로드 이벤트에서 해당 고객에 대한 데이터를 가져 오기 위해 SESSION 변수를 읽었습니다. 그렇다면 제어 레벨에서 포스트 백을 점검해야합니까?
편집 ~ 여기가 제어 여기
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
//Getting and storing the customer account number
if (string.IsNullOrEmpty((string)Session["CustomerNumber"]))
{
Session["CustomerNumber"] = cust.GetCustomerNumber(myHelper.GetCustomerIDFromQueryString());
LoadProductData();
}
}
}
의로드 이벤트가 myHelper 클래스입니다
static class myHelper
{
public static Guid GetCustomerIDFromQueryString()
{
//Getting the GUID (used as customerid in CRM) from the URL request of the selected account.
return Sql.ToGuid(System.Web.HttpContext.Current.Request["ID"]);
}
}
}
"이상한 결과"는 무엇입니까? –
때로는 데이터를 얻지 못하는 경우가 있습니다. PostBack을 제거하면 모든 것이 잘 작동합니다. 나는 내가하고있는 일과 함께 나의 가락을 편집했다. –
왜 세션 변수에 배치해야합니까? 왜 당신은 당신의 통제에서 요청에 접근 할 수 없습니까? – womp