Beispiel #1
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        HttpResponse.RemoveOutputCacheItem("/StateProvinceList.aspx");
        string    strCountryText = txtCountryText.Text.Replace(Environment.NewLine, "<br />");
        DataTable dt             = VADBCommander.CountryTextInd(countryid.ToString(), Convert.ToString(ViewState["firstCategory"]));

        try
        {
            if (dt.Rows.Count > 0)
            {
                VADBCommander.CountryTextEdit(countryid.ToString(), strCountryText, Convert.ToString(ViewState["firstCategory"]));
            }
            else
            {
                VADBCommander.CountryTextAdd(countryid.ToString(), strCountryText, Convert.ToString(ViewState["firstCategory"]));
            }
            lblInfo.Text = "Data saved.";
            DataTable dt4 = VADBCommander.CountryTextInd(countryid.ToString(), Convert.ToString(ViewState["firstCategory"]));
            if (dt4.Rows.Count > 0)
            {
                if (dt4.Rows[0]["countryText"] != null)
                {
                    lblCountryInfo.Text = dt4.Rows[0]["countryText"].ToString();
                    txtCountryText.Text = dt4.Rows[0]["countryText"].ToString().Replace("<br />-ipx-", Environment.NewLine);
                }
                if (dt4.Rows[0]["countryText2"] != null)
                {
                    lblInfo2.Text = dt4.Rows[0]["countryText2"].ToString();

                    if (string.IsNullOrEmpty(lblInfo2.Text))
                    {
                        OrangeTitle.Visible = false;
                    }
                    txtCountryText2.Text = dt4.Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine);
                }
            }
        }
        catch (Exception ex)
        {
            lblInfo.Text = ex.Message;
        }
    }
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        string    strCountryText = txtCountryText.Text.Replace(Environment.NewLine, "<br />");
        DataTable dt             = VADBCommander.GetMainCountryText(countryid.ToString());

        try
        {
            if (dt.Rows.Count > 0)
            {
                VADBCommander.CountryTextEdit(countryid.ToString(), strCountryText, null);
            }
            else
            {
                VADBCommander.CountryTextAdd(countryid.ToString(), strCountryText, null);
            }
            lblInfo.Text     = "Data Saved successfully";
            lblerrormsg.Text = string.Empty;
            DataTable dt4 = VADBCommander.GetMainCountryText(countryid.ToString());
            if (dt4.Rows.Count > 0)
            {
                if (dt4.Rows[0]["countryText"] != null)
                {
                    lblCountryInfo.Text = dt4.Rows[0]["countryText"].ToString();
                    txtCountryText.Text = dt4.Rows[0]["countryText"].ToString().Replace("<br />-ipx-", Environment.NewLine);
                }
                if (dt4.Rows[0]["countryText2"] != null)
                {
                    lblInfo2.Text        = dt4.Rows[0]["countryText2"].ToString();
                    txtCountryText2.Text = dt4.Rows[0]["countryText2"].ToString().Replace("<br />", Environment.NewLine);
                }
            }
            BindCountryFirst();
        }
        catch (Exception ex)
        {
            lblInfo.Text = ex.Message;
        }
    }