takachaa / .net-Framework

0 stars 0 forks source link

【Webフォーム】上級者の書き方 #27

Open takachaa opened 6 years ago

takachaa commented 6 years ago

GETパラメータの取得技

if (!string.IsNullOrWhiteSpace(Request.QueryString["custId"]))
{
                customerId = Request.QueryString["custId"];
}
else
{
                ShowMessage(this.Page, "顧客情報が取得できませんでした。");
                Response.Redirect("axis0100.aspx");
                return;
}
takachaa commented 6 years ago

入力値チェック

テキスト

if (String.IsNullOrEmpty(txtUserCode.Text) || String.IsNullOrEmpty(txtPassword.Text))
{
    ShowMessage(this.Page, "ログインID、パスワードを入力してください。");
    return;
}

ドロップダウンリスト

if (ddlCommodity.SelectedIndex == 0)
{
    ShowMessage(this.Page, "商材を選択してください。");
    return;
}